diff options
Diffstat (limited to 'db/migrate/20211111112713_add_fk_compliance_violations_violating_user.rb')
-rw-r--r-- | db/migrate/20211111112713_add_fk_compliance_violations_violating_user.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20211111112713_add_fk_compliance_violations_violating_user.rb b/db/migrate/20211111112713_add_fk_compliance_violations_violating_user.rb new file mode 100644 index 00000000000..af1cd6f07ed --- /dev/null +++ b/db/migrate/20211111112713_add_fk_compliance_violations_violating_user.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddFkComplianceViolationsViolatingUser < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :merge_requests_compliance_violations, + :users, + column: :violating_user_id, + on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :merge_requests_compliance_violations, column: :violating_user_id + end + end +end |