diff options
Diffstat (limited to 'db/migrate/20221104094042_remove_users_foreign_key_to_projects.rb')
-rw-r--r-- | db/migrate/20221104094042_remove_users_foreign_key_to_projects.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20221104094042_remove_users_foreign_key_to_projects.rb b/db/migrate/20221104094042_remove_users_foreign_key_to_projects.rb new file mode 100644 index 00000000000..19497c80b8e --- /dev/null +++ b/db/migrate/20221104094042_remove_users_foreign_key_to_projects.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveUsersForeignKeyToProjects < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + with_lock_retries do + remove_foreign_key_if_exists :projects, column: :creator_id + end + end + + def down + add_concurrent_foreign_key :projects, :users, column: :creator_id, on_delete: :nullify, validate: false + end +end |