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-16 13:42:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-16 13:42:19 +0300
commit84d1bd786125c1c14a3ba5f63e38a4cc736a9027 (patch)
treef550fa965f507077e20dbb6d61a8269a99ef7107 /db/post_migrate/20240110094510_remove_fk_from_ci_job_artifact_state.rb
parent3a105e36e689f7b75482236712f1a47fd5a76814 (diff)
Add latest changes from gitlab-org/gitlab@16-8-stable-eev16.8.0-rc42
Diffstat (limited to 'db/post_migrate/20240110094510_remove_fk_from_ci_job_artifact_state.rb')
-rw-r--r--db/post_migrate/20240110094510_remove_fk_from_ci_job_artifact_state.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/db/post_migrate/20240110094510_remove_fk_from_ci_job_artifact_state.rb b/db/post_migrate/20240110094510_remove_fk_from_ci_job_artifact_state.rb
new file mode 100644
index 00000000000..bbe1f39e3ed
--- /dev/null
+++ b/db/post_migrate/20240110094510_remove_fk_from_ci_job_artifact_state.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+class RemoveFkFromCiJobArtifactState < Gitlab::Database::Migration[2.2]
+ milestone '16.8'
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :ci_job_artifact_states
+ TARGET_TABLE_NAME = :ci_job_artifacts
+ COLUMN = :job_artifact_id
+ TARGET_COLUMN = :id
+ FK_NAME = :fk_rails_80a9cba3b2
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ column: COLUMN,
+ target_column: TARGET_COLUMN,
+ validate: true,
+ reverse_lock_order: true,
+ on_delete: :cascade,
+ name: FK_NAME
+ )
+ end
+end