Resolve "Configure push rules at a group level" - db and models part
What does this MR do?
In order to connect groups with push rules and allow to configure push rules for group we need to add connection in database.
Same behaviour is introduced for projects (via project_settings
model) and application settings here: !28286 (merged)
Screenshots
migrations output:
== 20200407120000 AddPushRuleIdToGroups: migrating ============================
-- add_column(:namespaces, :push_rule_id, :bigint)
-> 0.0028s
== 20200407120000 AddPushRuleIdToGroups: migrated (0.0104s) ===================
== 20200407121321 AddPushRuleForeignKeyToGroups: migrating ====================
-- transaction_open?()
-> 0.0000s
-- index_exists?(:namespaces, :push_rule_id, {:unique=>true, :algorithm=>:concurrently})
-> 0.0072s
-- execute("SET statement_timeout TO 0")
-> 0.0002s
-- add_index(:namespaces, :push_rule_id, {:unique=>true, :algorithm=>:concurrently})
-> 0.0094s
-- execute("RESET ALL")
-> 0.0002s
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:namespaces)
-> 0.0030s
-- execute("ALTER TABLE namespaces\nADD CONSTRAINT fk_3448c97865\nFOREIGN KEY (push_rule_id)\nREFERENCES push_rules (id)\nON DELETE CASCADE\nNOT VALID;\n")
-> 0.0044s
-- execute("SET statement_timeout TO 0")
-> 0.0002s
-- execute("ALTER TABLE namespaces VALIDATE CONSTRAINT fk_3448c97865;")
-> 0.0068s
-- execute("RESET ALL")
-> 0.0002s
== 20200407121321 AddPushRuleForeignKeyToGroups: migrated (0.0321s) ===========
down migration output:
== 20200407120000 AddPushRuleIdToGroups: reverting ============================
-- remove_column(:namespaces, :push_rule_id)
-> 0.0182s
== 20200407120000 AddPushRuleIdToGroups: reverted (0.0279s) ===================
== 20200407121321 AddPushRuleForeignKeyToGroups: reverting ====================
-- foreign_keys(:namespaces)
-> 0.0031s
-- remove_foreign_key(:namespaces, {:column=>:push_rule_id})
-> 0.0036s
-- transaction_open?()
-> 0.0000s
-- index_exists?(:namespaces, :push_rule_id, {:algorithm=>:concurrently})
-> 0.0074s
-- execute("SET statement_timeout TO 0")
-> 0.0001s
-- remove_index(:namespaces, {:algorithm=>:concurrently, :column=>:push_rule_id})
-> 0.0086s
-- execute("RESET ALL")
-> 0.0002s
== 20200407121321 AddPushRuleForeignKeyToGroups: reverted (0.0235s) ===========
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
Related to #34370 (closed)
Edited by Mayra Cabrera