Swap FK dast_scanner_profiles_builds.ci_build_id to ci_builds for LFK
What does this MR do and why?
In !77908 (merged) we already added a "loose foreign key" 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.
Migration output
Up
== 20220110224913 RemoveDastScannerProfilesBuildsCiBuildIdFk: migrating =======
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:dast_scanner_profiles_builds)
-> 0.0046s
-- remove_foreign_key(:dast_scanner_profiles_builds, :ci_builds, {:name=>"fk_e4c49200f8"})
-> 0.0039s
== 20220110224913 RemoveDastScannerProfilesBuildsCiBuildIdFk: migrated (0.0123s)
Down
== 20220110224913 RemoveDastScannerProfilesBuildsCiBuildIdFk: reverting =======
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:dast_scanner_profiles_builds)
-> 0.0041s
-- transaction_open?()
-> 0.0000s
-- execute("ALTER TABLE dast_scanner_profiles_builds\nADD CONSTRAINT fk_e4c49200f8\nFOREIGN KEY (ci_build_id)\nREFERENCES ci_builds (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0063s
-- execute("SET statement_timeout TO 0")
-> 0.0008s
-- execute("ALTER TABLE dast_scanner_profiles_builds VALIDATE CONSTRAINT fk_e4c49200f8;")
-> 0.0210s
-- execute("RESET statement_timeout")
-> 0.0010s
== 20220110224913 RemoveDastScannerProfilesBuildsCiBuildIdFk: reverted (0.0479s)
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related issues
Related to #348274 (closed)