Add migration for "Provide instance level setting to enable or disable "default branch protection" at the group level for group owners"
requested to merge 211944-provide-instance-level-setting-to-enable-or-disable-default-branch-protection-at-the-group-migration into master
What does this MR do?
For #211944 (closed)
I am splitting the work across different MRS. This MR adds the necessary column in application_settings
table
Up migration:
▶ VERBOSE=true rake db:migrate
== 20200413072059 AddGroupOwnersCanManageDefaultBranchProtectionToApplicationSettings: migrating
-- transaction_open?()
-> 0.0000s
-- execute("SET statement_timeout TO 0")
-> 0.0003s
-- transaction()
-- add_column(:application_settings, :group_owners_can_manage_default_branch_protection, :boolean, {:default=>nil})
-> 0.0050s
-- change_column_default(:application_settings, :group_owners_can_manage_default_branch_protection, true)
-> 0.0279s
-> 0.0337s
-- columns(:application_settings)
-> 0.0232s
-- transaction_open?()
-> 0.0000s
-- exec_query("SELECT COUNT(*) AS count FROM \"application_settings\"")
-> 0.0020s
-- exec_query("SELECT \"application_settings\".\"id\" FROM \"application_settings\" ORDER BY \"application_settings\".\"id\" ASC LIMIT 1")
-> 0.0006s
-- exec_query("SELECT \"application_settings\".\"id\" FROM \"application_settings\" WHERE \"application_settings\".\"id\" >= 1 ORDER BY \"application_settings\".\"id\" ASC LIMIT 1 OFFSET 1")
-> 0.0004s
-- execute("UPDATE \"application_settings\" SET \"group_owners_can_manage_default_branch_protection\" = TRUE WHERE \"application_settings\".\"id\" >= 1")
-> 0.0034s
-- change_column_null(:application_settings, :group_owners_can_manage_default_branch_protection, false)
-> 0.0012s
-- execute("RESET ALL")
-> 0.0002s
== 20200413072059 AddGroupOwnersCanManageDefaultBranchProtectionToApplicationSettings: migrated (0.0662s)
Down migration
▶ VERBOSE=true rake db:rollback STEP=1
== 20200413072059 AddGroupOwnersCanManageDefaultBranchProtectionToApplicationSettings: reverting
-- remove_column(:application_settings, :group_owners_can_manage_default_branch_protection)
-> 0.0023s
== 20200413072059 AddGroupOwnersCanManageDefaultBranchProtectionToApplicationSettings: reverted (0.0024s)
Screenshots
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 Mayra Cabrera