gitlab-org--gitlab-foss/db/migrate/20180209165249_add_closed_by_to_issues.rb

21 lines
616 B
Ruby
Raw Normal View History

2018-02-09 13:23:55 -05: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
include Gitlab::Database::MigrationHelpers
2018-02-27 11:18:01 -05:00
disable_ddl_transaction!
2018-02-09 13:23:55 -05:00
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
2018-02-27 11:18:01 -05:00
def up
2018-02-09 13:23:55 -05:00
add_column :issues, :closed_by_id, :integer
2018-02-27 11:18:01 -05: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 13:23:55 -05:00
end
end