LFK: Remove foreign key requirements_management_test_reports.build_id
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
== 20220110231420 RemoveRequirementsManagementTestReportsBuildIdFk: migrating =
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:requirements_management_test_reports)
-> 0.0049s
-- remove_foreign_key(:requirements_management_test_reports, :ci_builds, {:name=>"fk_rails_e67d085910"})
-> 0.0045s
== 20220110231420 RemoveRequirementsManagementTestReportsBuildIdFk: migrated (0.0133s)
Down
== 20220110231420 RemoveRequirementsManagementTestReportsBuildIdFk: reverting =
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:requirements_management_test_reports)
-> 0.0054s
-- transaction_open?()
-> 0.0000s
-- execute("ALTER TABLE requirements_management_test_reports\nADD CONSTRAINT fk_rails_e67d085910\nFOREIGN KEY (build_id)\nREFERENCES ci_builds (id)\nON DELETE SET NULL\nNOT VALID;\n")
-> 0.0047s
-- execute("SET statement_timeout TO 0")
-> 0.0006s
-- execute("ALTER TABLE requirements_management_test_reports VALIDATE CONSTRAINT fk_rails_e67d085910;")
-> 0.0182s
-- execute("RESET statement_timeout")
-> 0.0007s
== 20220110231420 RemoveRequirementsManagementTestReportsBuildIdFk: reverted (0.0409s)
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)