diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-07-29 12:31:15 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-07-29 15:20:39 +0530 |
commit | cebcc417eda08711ad17a433d6d9b4f49830c04c (patch) | |
tree | 08276afb13fe04b41b6d7a20df0cd11962fa9a6c /db/migrate/20160705055809_remove_developers_can_push_from_protected_branches.rb | |
parent | 0a8aeb46dc187cc309ddbe23d8624f5d24b6218c (diff) | |
download | gitlab-ce-cebcc417eda08711ad17a433d6d9b4f49830c04c.tar.gz |
Implement final review comments from @rymai.
1. Instantiate `ProtectedBranchesAccessSelect` from `dispatcher`
2. Use `can?(user, ...)` instead of `user.can?(...)`
3. Add `DOWNTIME` notes to all migrations added in !5081.
4. Add an explicit `down` method for migrations removing the
`developers_can_push` and `developers_can_merge` columns, ensuring that
the columns created (on rollback) have the appropriate defaults.
5. Remove duplicate CHANGELOG entries.
6. Blank lines after guard clauses.
Diffstat (limited to 'db/migrate/20160705055809_remove_developers_can_push_from_protected_branches.rb')
-rw-r--r-- | db/migrate/20160705055809_remove_developers_can_push_from_protected_branches.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/db/migrate/20160705055809_remove_developers_can_push_from_protected_branches.rb b/db/migrate/20160705055809_remove_developers_can_push_from_protected_branches.rb index ad6ad43686d..f563f660ddf 100644 --- a/db/migrate/20160705055809_remove_developers_can_push_from_protected_branches.rb +++ b/db/migrate/20160705055809_remove_developers_can_push_from_protected_branches.rb @@ -2,7 +2,18 @@ # for more information on how to write migrations for GitLab. class RemoveDevelopersCanPushFromProtectedBranches < ActiveRecord::Migration - def change + include Gitlab::Database::MigrationHelpers + + # This is only required for `#down` + disable_ddl_transaction! + + DOWNTIME = false + + def up remove_column :protected_branches, :developers_can_push, :boolean end + + def down + add_column_with_default(:protected_branches, :developers_can_push, :boolean, default: false, null: false) + end end |