gitlab-org--gitlab-foss/db/migrate/20170707184243_add_group_milestone_id_indexes.rb

22 lines
494 B
Ruby
Raw Normal View History

2017-07-07 11:08:49 -04:00
class AddGroupMilestoneIdIndexes < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
DOWNTIME = false
def up
2017-07-07 14:01:30 -04:00
return if index_exists?(:milestones, :group_id)
2017-07-07 11:08:49 -04:00
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