gitlab-org--gitlab-foss/db/migrate/20160919145149_add_group_id_to_labels.rb
Yorick Peterse 766060bcdf
Enforce use of add_concurrent_foreign_key
This adds a Rubocop rule to enforce the use of
add_concurrent_foreign_key instead of the regular add_foreign_key
method. This cop has been disabled for existing migrations so we don't
need to change those.
2017-02-10 21:51:09 +01:00

13 lines
390 B
Ruby

class AddGroupIdToLabels < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def change
add_column :labels, :group_id, :integer
add_foreign_key :labels, :namespaces, column: :group_id, on_delete: :cascade # rubocop: disable Migration/AddConcurrentForeignKey
add_concurrent_index :labels, :group_id
end
end