Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20230823161514_remove_namespaces_routes_namespace_id_fk.rb')
-rw-r--r--db/post_migrate/20230823161514_remove_namespaces_routes_namespace_id_fk.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/db/post_migrate/20230823161514_remove_namespaces_routes_namespace_id_fk.rb b/db/post_migrate/20230823161514_remove_namespaces_routes_namespace_id_fk.rb
new file mode 100644
index 00000000000..a640ac686ed
--- /dev/null
+++ b/db/post_migrate/20230823161514_remove_namespaces_routes_namespace_id_fk.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class RemoveNamespacesRoutesNamespaceIdFk < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ FOREIGN_KEY_NAME = "fk_bb2e5b8968"
+
+ def up
+ return unless foreign_key_exists?(:routes, :namespaces, name: FOREIGN_KEY_NAME)
+
+ with_lock_retries do
+ remove_foreign_key_if_exists(:routes, :namespaces,
+ name: FOREIGN_KEY_NAME, reverse_lock_order: true)
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(:routes, :namespaces,
+ name: FOREIGN_KEY_NAME, column: :namespace_id,
+ target_column: :id, on_delete: :cascade)
+ end
+end