Skip to content

Remove foreign key constraint ci_pending_builds.namespace_id

What does this MR do and why?

The loose foreign key was already added for this in !77636 (merged) . We've confirmed in #348269 (closed) that it is indeed safe to swap these foreign keys for loose foreign keys.

Migrations

Up

== 20220106233459 RemoveForeignKeyCiPendingBuildsNamespaceId: migrating =======
-- transaction_open?()
   -> 0.0000s
-- foreign_keys(:ci_pending_builds)
   -> 0.0032s
-- remove_foreign_key(:ci_pending_builds, :namespaces, {:name=>"fk_fdc0137e4a"})
   -> 0.0041s
== 20220106233459 RemoveForeignKeyCiPendingBuildsNamespaceId: migrated (0.0179s)

Down

== 20220106233459 RemoveForeignKeyCiPendingBuildsNamespaceId: reverting =======
-- transaction_open?()
   -> 0.0000s
-- foreign_keys(:ci_pending_builds)
   -> 0.0035s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE ci_pending_builds\nADD CONSTRAINT fk_fdc0137e4a\nFOREIGN KEY (namespace_id)\nREFERENCES namespaces (id)\nON DELETE CASCADE\nNOT VALID;\n")
   -> 0.0020s
-- execute("ALTER TABLE ci_pending_builds VALIDATE CONSTRAINT fk_fdc0137e4a;")
   -> 0.0049s
== 20220106233459 RemoveForeignKeyCiPendingBuildsNamespaceId: reverted (0.0270s)

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.

Related to #348269 (closed)

Edited by Dylan Griffith

Merge request reports