diff options
Diffstat (limited to 'db/post_migrate/20220106235626_remove_foreign_key_ci_runner_namespaces_namespace_id.rb')
-rw-r--r-- | db/post_migrate/20220106235626_remove_foreign_key_ci_runner_namespaces_namespace_id.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/post_migrate/20220106235626_remove_foreign_key_ci_runner_namespaces_namespace_id.rb b/db/post_migrate/20220106235626_remove_foreign_key_ci_runner_namespaces_namespace_id.rb new file mode 100644 index 00000000000..61ca066401e --- /dev/null +++ b/db/post_migrate/20220106235626_remove_foreign_key_ci_runner_namespaces_namespace_id.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveForeignKeyCiRunnerNamespacesNamespaceId < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + CONSTRAINT_NAME = 'fk_rails_f9d9ed3308' + + def up + with_lock_retries do + remove_foreign_key_if_exists(:ci_runner_namespaces, :namespaces, name: CONSTRAINT_NAME) + end + end + + def down + add_concurrent_foreign_key :ci_runner_namespaces, :namespaces, column: :namespace_id, on_delete: :cascade, name: CONSTRAINT_NAME + end +end |