diff options
Diffstat (limited to 'db/post_migrate/20221010123040_add_compliance_framework_fk_to_namespace_settings.rb')
-rw-r--r-- | db/post_migrate/20221010123040_add_compliance_framework_fk_to_namespace_settings.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/db/post_migrate/20221010123040_add_compliance_framework_fk_to_namespace_settings.rb b/db/post_migrate/20221010123040_add_compliance_framework_fk_to_namespace_settings.rb new file mode 100644 index 00000000000..5d4966fd580 --- /dev/null +++ b/db/post_migrate/20221010123040_add_compliance_framework_fk_to_namespace_settings.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddComplianceFrameworkFkToNamespaceSettings < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :namespace_settings, :compliance_management_frameworks, + column: :default_compliance_framework_id, on_delete: :nullify, reverse_lock_order: true + end + + def down + with_lock_retries do + remove_foreign_key :namespace_settings, column: :default_compliance_framework_id + end + end +end |