gitlab-org--gitlab-foss/db/migrate/20180209165249_add_closed_b...

21 lines
621 B
Ruby
Raw Normal View History

2018-02-09 18:23:55 +00:00
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddClosedByToIssues < ActiveRecord::Migration[4.2]
2018-02-09 18:23:55 +00:00
include Gitlab::Database::MigrationHelpers
2018-02-27 16:18:01 +00:00
disable_ddl_transaction!
2018-02-09 18:23:55 +00:00
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
2018-02-27 16:18:01 +00:00
def up
2018-02-09 18:23:55 +00:00
add_column :issues, :closed_by_id, :integer
2018-02-27 16:18:01 +00:00
add_concurrent_foreign_key :issues, :users, column: :closed_by_id, on_delete: :nullify
end
def down
remove_foreign_key :issues, column: :closed_by_id
remove_column :issues, :closed_by_id
2018-02-09 18:23:55 +00:00
end
end