diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2018-01-02 18:06:44 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-01-02 18:06:44 +0300 |
commit | 2665aea6275cc82888ed3e3ab3dbe384028d663c (patch) | |
tree | c293f8e3033667aa992b53f38d2e135093529242 /db/migrate/20171216112339_add_foreign_key_for_members.rb | |
parent | 3f44c4cedbbd9b72fdf28e83caaec345934e1d8d (diff) |
Fix user membership destroy relation
Diffstat (limited to 'db/migrate/20171216112339_add_foreign_key_for_members.rb')
-rw-r--r-- | db/migrate/20171216112339_add_foreign_key_for_members.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20171216112339_add_foreign_key_for_members.rb b/db/migrate/20171216112339_add_foreign_key_for_members.rb new file mode 100644 index 00000000000..be17769be6a --- /dev/null +++ b/db/migrate/20171216112339_add_foreign_key_for_members.rb @@ -0,0 +1,21 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddForeignKeyForMembers < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key(:members, + :users, + column: :user_id) + end + + def down + remove_foreign_key(:members, column: :user_id) + end +end |