Change constraint on foreign key from cascade to nullify
What does this MR do?
I think I got one thing wrong while coding this. This MR fixes it.
Screenshots
up
== 20200417075843 RemoveAndAddForeignKeyToProjectSettings: migrating ==========
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:project_settings)
-> 0.0029s
-- execute("ALTER TABLE project_settings\nADD CONSTRAINT fk_project_settings_push_rule_id\nFOREIGN KEY (push_rule_id)\nREFERENCES push_rules (id)\nON DELETE SET NULL\nNOT VALID;\n")
-> 0.0034s
-- execute("SET statement_timeout TO 0")
-> 0.0002s
-- execute("ALTER TABLE project_settings VALIDATE CONSTRAINT fk_project_settings_push_rule_id;")
-> 0.0014s
-- execute("RESET ALL")
-> 0.0002s
-- foreign_keys(:project_settings)
-> 0.0020s
-- remove_foreign_key(:project_settings, {:column=>:push_rule_id, :on_delete=>:cascade})
-> 0.0028s
== 20200417075843 RemoveAndAddForeignKeyToProjectSettings: migrated (0.0219s) =
down:
== 20200417075843 RemoveAndAddForeignKeyToProjectSettings: reverting ==========
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:project_settings)
-> 0.0034s
-- execute("ALTER TABLE project_settings\nADD CONSTRAINT fk_413a953e20\nFOREIGN KEY (push_rule_id)\nREFERENCES push_rules (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0025s
-- execute("SET statement_timeout TO 0")
-> 0.0002s
-- execute("ALTER TABLE project_settings VALIDATE CONSTRAINT fk_413a953e20;")
-> 0.0013s
-- execute("RESET ALL")
-> 0.0002s
-- foreign_keys(:project_settings)
-> 0.0022s
-- remove_foreign_key(:project_settings, {:column=>:push_rule_id, :name=>"fk_project_settings_push_rule_id", :on_delete=>:nullify})
-> 0.0032s
== 20200417075843 RemoveAndAddForeignKeyToProjectSettings: reverted (0.0209s) =
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Yorick Peterse