Skip to content
Snippets Groups Projects
Verified Commit 89d4d45e authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

Remove FK dast_site_profiles_builds.ci_build_id as we have LFK

In !77908 we
already added a ["loose foreign key"](
https://docs.gitlab.com/ee/development/database/loose_foreign_keys.html)
to replace this foreign key. Now that this has been running fine in
production we should be OK to remove the foreign key altogether.

This was added in a post-deployment migration as we want to ensure that
they have the correct code running with the loose foreign key in place
before we remove the foreign key to ensure that there isn't any lost
deletes.

Changelog: other
parent eccefaed
No related branches found
No related tags found
1 merge request!77916LFK: Remove foreign key dast_site_profiles_builds.ci_build_id
# frozen_string_literal: true
class RemoveDastSiteProfilesBuildsCiBuildIdFk < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
CONSTRAINT_NAME = 'fk_a325505e99'
def up
with_lock_retries do
remove_foreign_key_if_exists(:dast_site_profiles_builds, :ci_builds, name: CONSTRAINT_NAME)
end
end
def down
add_concurrent_foreign_key(:dast_site_profiles_builds, :ci_builds, column: :ci_build_id, on_delete: :cascade, name: CONSTRAINT_NAME)
end
end
e7d9d79ffb8989ab39fe719217f22736244df70c2b1461ef5a1a3f1e74e43870
\ No newline at end of file
......@@ -29562,9 +29562,6 @@ ALTER TABLE ONLY ci_builds
ALTER TABLE ONLY ci_pipelines
ADD CONSTRAINT fk_a23be95014 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
 
ALTER TABLE ONLY dast_site_profiles_builds
ADD CONSTRAINT fk_a325505e99 FOREIGN KEY (ci_build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
ALTER TABLE ONLY bulk_import_entities
ADD CONSTRAINT fk_a44ff95be5 FOREIGN KEY (parent_id) REFERENCES bulk_import_entities(id) ON DELETE CASCADE;
 
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment