diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-23 15:08:04 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-23 15:08:04 +0000 |
commit | b465b2440bbf8ac8c4ef21728ab14fb48589057c (patch) | |
tree | 6e6d76871cc1ecbbf0ad7162605ad65972bf94b6 /db | |
parent | 4a7ca716f68682c41889dc480c029d71dd121f4e (diff) | |
download | gitlab-ce-b465b2440bbf8ac8c4ef21728ab14fb48589057c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
5 files changed, 72 insertions, 6 deletions
diff --git a/db/post_migrate/20230222101420_remove_fk_to_ci_build_ci_pending_build_on_build_id.rb b/db/post_migrate/20230222101420_remove_fk_to_ci_build_ci_pending_build_on_build_id.rb new file mode 100644 index 00000000000..36e2f0f34f3 --- /dev/null +++ b/db/post_migrate/20230222101420_remove_fk_to_ci_build_ci_pending_build_on_build_id.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class RemoveFkToCiBuildCiPendingBuildOnBuildId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + SOURCE_TABLE_NAME = :ci_pending_builds + TARGET_TABLE_NAME = :ci_builds + COLUMN = :build_id + TARGET_COLUMN = :id + FK_NAME = :fk_rails_725a2644a3 + + 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 diff --git a/db/post_migrate/20230222102421_remove_fk_to_ci_build_ci_running_build_on_build_id.rb b/db/post_migrate/20230222102421_remove_fk_to_ci_build_ci_running_build_on_build_id.rb new file mode 100644 index 00000000000..d3cbfa649c3 --- /dev/null +++ b/db/post_migrate/20230222102421_remove_fk_to_ci_build_ci_running_build_on_build_id.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class RemoveFkToCiBuildCiRunningBuildOnBuildId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + SOURCE_TABLE_NAME = :ci_running_builds + TARGET_TABLE_NAME = :ci_builds + COLUMN = :build_id + TARGET_COLUMN = :id + FK_NAME = :fk_rails_da45cfa165 + + 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 diff --git a/db/schema_migrations/20230222101420 b/db/schema_migrations/20230222101420 new file mode 100644 index 00000000000..f0cd65454ac --- /dev/null +++ b/db/schema_migrations/20230222101420 @@ -0,0 +1 @@ +74413d13062dd7a48d07f9839b4a22db3f7358cffda403a036dfa1686fb693c8
\ No newline at end of file diff --git a/db/schema_migrations/20230222102421 b/db/schema_migrations/20230222102421 new file mode 100644 index 00000000000..2b186e0e34a --- /dev/null +++ b/db/schema_migrations/20230222102421 @@ -0,0 +1 @@ +52ca4df8ee309791bb7fc4078a1298555b962137f1d07585e361b008d591164c
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 34b480a90ed..335ce18eb3b 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -35655,9 +35655,6 @@ ALTER TABLE ONLY project_custom_attributes ADD CONSTRAINT fk_rails_719c3dccc5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; ALTER TABLE ONLY ci_pending_builds - ADD CONSTRAINT fk_rails_725a2644a3 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE; - -ALTER TABLE ONLY ci_pending_builds ADD CONSTRAINT fk_rails_725a2644a3_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE; ALTER TABLE security_findings @@ -36330,9 +36327,6 @@ ALTER TABLE ONLY merge_request_reviewers ADD CONSTRAINT fk_rails_d9fec24b9d FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; ALTER TABLE ONLY ci_running_builds - ADD CONSTRAINT fk_rails_da45cfa165 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE; - -ALTER TABLE ONLY ci_running_builds ADD CONSTRAINT fk_rails_da45cfa165_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE; ALTER TABLE ONLY jira_imports |