diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-25 15:09:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-25 15:09:33 +0000 |
commit | ba8e92f7c9938d7dba333d2396cdd14bfa0de726 (patch) | |
tree | 071d3b0577dce2e95eefa6a504910bc7856181f3 /db/post_migrate/20220119154442_remove_ci_pipelines_merge_requests_head_pipeline_id_fk.rb | |
parent | d2d913b606702ecefa01f03362602fde256e3f75 (diff) | |
download | gitlab-ce-ba8e92f7c9938d7dba333d2396cdd14bfa0de726.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/post_migrate/20220119154442_remove_ci_pipelines_merge_requests_head_pipeline_id_fk.rb')
-rw-r--r-- | db/post_migrate/20220119154442_remove_ci_pipelines_merge_requests_head_pipeline_id_fk.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/post_migrate/20220119154442_remove_ci_pipelines_merge_requests_head_pipeline_id_fk.rb b/db/post_migrate/20220119154442_remove_ci_pipelines_merge_requests_head_pipeline_id_fk.rb new file mode 100644 index 00000000000..6a978ce2ab1 --- /dev/null +++ b/db/post_migrate/20220119154442_remove_ci_pipelines_merge_requests_head_pipeline_id_fk.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveCiPipelinesMergeRequestsHeadPipelineIdFk < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + def up + with_lock_retries do + execute('LOCK ci_pipelines, merge_requests IN ACCESS EXCLUSIVE MODE') + + remove_foreign_key_if_exists(:merge_requests, :ci_pipelines, name: "fk_fd82eae0b9") + end + end + + def down + add_concurrent_foreign_key(:merge_requests, :ci_pipelines, name: "fk_fd82eae0b9", column: :head_pipeline_id, target_column: :id, on_delete: :nullify) + end +end |