Skip to content

Remove foreign key constraint ci_runner_namespaces.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 this foreign key for a loose foreign key.

Migrations

Up

== 20220106235626 RemoveForeignKeyCiRunnerNamespacesNamespaceId: migrating ====
-- transaction_open?()
   -> 0.0000s
-- foreign_keys(:ci_runner_namespaces)
   -> 0.0030s
-- remove_foreign_key(:ci_runner_namespaces, :namespaces, {:name=>"fk_rails_f9d9ed3308"})
   -> 0.0054s
== 20220106235626 RemoveForeignKeyCiRunnerNamespacesNamespaceId: migrated (0.0178s)

Down

== 20220106235626 RemoveForeignKeyCiRunnerNamespacesNamespaceId: reverting ====
-- transaction_open?()
   -> 0.0000s
-- foreign_keys(:ci_runner_namespaces)
   -> 0.0031s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE ci_runner_namespaces\nADD CONSTRAINT fk_rails_f9d9ed3308\nFOREIGN KEY (namespace_id)\nREFERENCES namespaces (id)\nON DELETE CASCADE\nNOT VALID;\n")
   -> 0.0023s
-- execute("ALTER TABLE ci_runner_namespaces VALIDATE CONSTRAINT fk_rails_f9d9ed3308;")
   -> 0.0033s
== 20220106235626 RemoveForeignKeyCiRunnerNamespacesNamespaceId: reverted (0.0169s)

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