diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-07-07 22:53:18 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-07-07 22:53:18 +0000 |
commit | bf23d6c610c0d656bd76c16d348b72de39eb8687 (patch) | |
tree | e868132107cefe798c4b5bedf55d385767d7a02a | |
parent | 7414f5407b6252ea91cbd9b2210e993a1a795ba0 (diff) | |
parent | b24ef9ce2addea3e89cce0c20534091158a0fd9b (diff) | |
download | gitlab-ce-bf23d6c610c0d656bd76c16d348b72de39eb8687.tar.gz |
Merge branch 'fix_migrations_in_the_future' into 'master'
fix migrations in the future
Closes #34832
See merge request !12719
-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" |