diff options
author | Felipe Artur <felipefac@gmail.com> | 2017-07-07 14:03:13 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2017-07-07 14:35:32 -0300 |
commit | 4e07305b27101b164d983d51fad60cf715f31501 (patch) | |
tree | 8d3ae9750c477911b8d8f96f48a464e050c1e22a /db/migrate/20170707184243_add_group_milestone_id_indexes.rb | |
parent | 9c14954a81778a603a38024ce1f3f4953457d13f (diff) | |
download | gitlab-ce-4e07305b27101b164d983d51fad60cf715f31501.tar.gz |
fix migrations in the future
Diffstat (limited to 'db/migrate/20170707184243_add_group_milestone_id_indexes.rb')
-rw-r--r-- | db/migrate/20170707184243_add_group_milestone_id_indexes.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20170707184243_add_group_milestone_id_indexes.rb b/db/migrate/20170707184243_add_group_milestone_id_indexes.rb new file mode 100644 index 00000000000..d48b1884179 --- /dev/null +++ b/db/migrate/20170707184243_add_group_milestone_id_indexes.rb @@ -0,0 +1,19 @@ +class AddGroupMilestoneIdIndexes < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + DOWNTIME = false + + def up + add_concurrent_foreign_key :milestones, :namespaces, column: :group_id, on_delete: :cascade + + add_concurrent_index :milestones, :group_id + end + + def down + remove_foreign_key :milestones, column: :group_id + + remove_concurrent_index :milestones, :group_id + end +end |