summaryrefslogtreecommitdiff
path: root/db/post_migrate/20220106233459_remove_foreign_key_ci_pending_builds_namespace_id.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 09:16:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-20 09:16:11 +0000
commitedaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch)
tree11f143effbfeba52329fb7afbd05e6e2a3790241 /db/post_migrate/20220106233459_remove_foreign_key_ci_pending_builds_namespace_id.rb
parentd8a5691316400a0f7ec4f83832698f1988eb27c1 (diff)
downloadgitlab-ce-76a9e64d004e0c02c35b8165ca38d005afb5e823.tar.gz
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'db/post_migrate/20220106233459_remove_foreign_key_ci_pending_builds_namespace_id.rb')
-rw-r--r--db/post_migrate/20220106233459_remove_foreign_key_ci_pending_builds_namespace_id.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/post_migrate/20220106233459_remove_foreign_key_ci_pending_builds_namespace_id.rb b/db/post_migrate/20220106233459_remove_foreign_key_ci_pending_builds_namespace_id.rb
new file mode 100644
index 00000000000..1304f19708e
--- /dev/null
+++ b/db/post_migrate/20220106233459_remove_foreign_key_ci_pending_builds_namespace_id.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RemoveForeignKeyCiPendingBuildsNamespaceId < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ CONSTRAINT_NAME = 'fk_fdc0137e4a'
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(:ci_pending_builds, :namespaces, name: CONSTRAINT_NAME)
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key :ci_pending_builds, :namespaces, column: :namespace_id, on_delete: :cascade, name: CONSTRAINT_NAME
+ end
+end