diff options
author | haseeb <haseebeqx@yahoo.com> | 2018-02-27 21:48:01 +0530 |
---|---|---|
committer | haseeb <haseebeqx@yahoo.com> | 2018-02-28 19:25:24 +0530 |
commit | 9b0e8a09b1b35cc8fc893003afc59c78f5dc846f (patch) | |
tree | a2d5eba70418d42de927d7f2b86bd1b9c6b13e16 /db/migrate | |
parent | f211e47eb20959fdebc5ae0aabf66267ea521ee7 (diff) | |
download | gitlab-ce-9b0e8a09b1b35cc8fc893003afc59c78f5dc846f.tar.gz |
added forign key and specs
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20180209165249_add_closed_by_to_issues.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/db/migrate/20180209165249_add_closed_by_to_issues.rb b/db/migrate/20180209165249_add_closed_by_to_issues.rb index 043e3ef8688..e251afd7b49 100644 --- a/db/migrate/20180209165249_add_closed_by_to_issues.rb +++ b/db/migrate/20180209165249_add_closed_by_to_issues.rb @@ -4,10 +4,17 @@ class AddClosedByToIssues < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! # Set this constant to true if this migration requires downtime. DOWNTIME = false - def change + def up add_column :issues, :closed_by_id, :integer + 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 end end |