Remove FK dast_scanner_profiles_builds.ci_build_id as we have LFK

In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/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
# frozen_string_literal: true
class RemoveDastScannerProfilesBuildsCiBuildIdFk < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
CONSTRAINT_NAME = 'fk_e4c49200f8'
def up
with_lock_retries do
remove_foreign_key_if_exists(:dast_scanner_profiles_builds, :ci_builds, name: CONSTRAINT_NAME)
end
end
def down
add_concurrent_foreign_key(:dast_scanner_profiles_builds, :ci_builds, column: :ci_build_id, on_delete: :cascade, name: CONSTRAINT_NAME)
end
end
d8b206e26f6dd7e9d5f2b2d8cc5ce2e2bbe2d8d33317948f8cf110fe41872a5d
\ No newline at end of file
......@@ -29817,9 +29817,6 @@ ALTER TABLE ONLY gitlab_subscriptions
ALTER TABLE ONLY ci_triggers
ADD CONSTRAINT fk_e3e63f966e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY dast_scanner_profiles_builds
ADD CONSTRAINT fk_e4c49200f8 FOREIGN KEY (ci_build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_e719a85f8a FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment