diff options
-rw-r--r-- | db/migrate/20170707183807_add_group_id_to_milestones.rb (renamed from db/migrate/20170723183807_add_group_id_to_milestones.rb) | 2 | ||||
-rw-r--r-- | db/migrate/20170707184243_add_group_milestone_id_indexes.rb (renamed from db/migrate/20170724184243_add_group_milestone_id_indexes.rb) | 2 | ||||
-rw-r--r-- | db/migrate/20170707184244_remove_wrong_versions_from_schema_versions.rb | 10 | ||||
-rw-r--r-- | db/schema.rb | 2 |
4 files changed, 15 insertions, 1 deletions
diff --git a/db/migrate/20170723183807_add_group_id_to_milestones.rb b/db/migrate/20170707183807_add_group_id_to_milestones.rb index e46fc4f80f0..675ffd4a1c9 100644 --- a/db/migrate/20170723183807_add_group_id_to_milestones.rb +++ b/db/migrate/20170707183807_add_group_id_to_milestones.rb @@ -2,6 +2,8 @@ class AddGroupIdToMilestones < ActiveRecord::Migration DOWNTIME = false def up + return if column_exists? :milestones, :group_id + change_column_null :milestones, :project_id, true add_column :milestones, :group_id, :integer diff --git a/db/migrate/20170724184243_add_group_milestone_id_indexes.rb b/db/migrate/20170707184243_add_group_milestone_id_indexes.rb index d48b1884179..aa48fe90cad 100644 --- a/db/migrate/20170724184243_add_group_milestone_id_indexes.rb +++ b/db/migrate/20170707184243_add_group_milestone_id_indexes.rb @@ -6,6 +6,8 @@ class AddGroupMilestoneIdIndexes < ActiveRecord::Migration DOWNTIME = false def up + return if index_exists?(:milestones, :group_id) + add_concurrent_foreign_key :milestones, :namespaces, column: :group_id, on_delete: :cascade add_concurrent_index :milestones, :group_id diff --git a/db/migrate/20170707184244_remove_wrong_versions_from_schema_versions.rb b/db/migrate/20170707184244_remove_wrong_versions_from_schema_versions.rb new file mode 100644 index 00000000000..38536a8b06a --- /dev/null +++ b/db/migrate/20170707184244_remove_wrong_versions_from_schema_versions.rb @@ -0,0 +1,10 @@ +class RemoveWrongVersionsFromSchemaVersions < ActiveRecord::Migration + DOWNTIME = false + + def up + execute("DELETE FROM schema_migrations WHERE version IN ('20170723183807', '20170724184243')") + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 023783c2b3b..3dbe52c9c80 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170724184243) do +ActiveRecord::Schema.define(version: 20170707184244) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |