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:
authorGitLab Bot <gitlab-bot@gitlab.com>2024-01-03 03:07:15 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-03 03:07:15 +0300
commit25ba0c04e90a470bfdf3fe3a5b044a73157565d2 (patch)
tree9589a405ba956edeaa6d92a4fedbd3a1b422c793 /db/migrate
parent3a72ac775065b61bbdb285a8f4f6f152ccb4db49 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20231227103059_replace_fk_on_epics_issue_id.rb20
-rw-r--r--db/migrate/20231227104408_validate_fk_epics_issue_id_with_on_delete_nullify.rb16
-rw-r--r--db/migrate/20231227104711_remove_fk_epics_issue_id.rb21
3 files changed, 57 insertions, 0 deletions
diff --git a/db/migrate/20231227103059_replace_fk_on_epics_issue_id.rb b/db/migrate/20231227103059_replace_fk_on_epics_issue_id.rb
new file mode 100644
index 00000000000..e5dd4e868f0
--- /dev/null
+++ b/db/migrate/20231227103059_replace_fk_on_epics_issue_id.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class ReplaceFkOnEpicsIssueId < Gitlab::Database::Migration[2.2]
+ disable_ddl_transaction!
+
+ milestone '16.8'
+
+ FK_NAME = :fk_epics_issue_id_with_on_delete_nullify
+
+ def up
+ # This will replace the existing fk_893ee302e5
+ add_concurrent_foreign_key(:epics, :issues, column: :issue_id, on_delete: :nullify, validate: false, name: FK_NAME)
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists(:epics, column: :issue_id, on_delete: :nullify, name: FK_NAME)
+ end
+ end
+end
diff --git a/db/migrate/20231227104408_validate_fk_epics_issue_id_with_on_delete_nullify.rb b/db/migrate/20231227104408_validate_fk_epics_issue_id_with_on_delete_nullify.rb
new file mode 100644
index 00000000000..9f7601a704b
--- /dev/null
+++ b/db/migrate/20231227104408_validate_fk_epics_issue_id_with_on_delete_nullify.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class ValidateFkEpicsIssueIdWithOnDeleteNullify < Gitlab::Database::Migration[2.2]
+ milestone '16.8'
+
+ FK_NAME = :fk_epics_issue_id_with_on_delete_nullify
+
+ # foreign key added in db/migrate/20231227103059_replace_fk_on_epics_issue_id.rb
+ def up
+ validate_foreign_key(:epics, :issue_id, name: FK_NAME)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20231227104711_remove_fk_epics_issue_id.rb b/db/migrate/20231227104711_remove_fk_epics_issue_id.rb
new file mode 100644
index 00000000000..29752e8741c
--- /dev/null
+++ b/db/migrate/20231227104711_remove_fk_epics_issue_id.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RemoveFkEpicsIssueId < Gitlab::Database::Migration[2.2]
+ disable_ddl_transaction!
+
+ milestone '16.8'
+
+ FK_NAME = :fk_893ee302e5
+
+ # new foreign key added in db/migrate/20231227103059_replace_fk_on_epics_issue_id.rb
+ # and validated in db/migrate/20231227104408_validate_fk_epics_issue_id_with_on_delete_nullify.rb
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(:epics, column: :issue_id, on_delete: :cascade, name: FK_NAME)
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(:epics, :issues, column: :issue_id, on_delete: :cascade, validate: false, name: FK_NAME)
+ end
+end