diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-07-05 09:59:15 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-07-29 12:50:39 +0300 |
commit | f1e46d1e63faf63f1dc9960c5f28d5260dfc84db (patch) | |
tree | e11b911e687d221f9abe14694d45aa8bf6a51527 /db/migrate/20160705054952_add_protected_branches_merge_access.rb | |
parent | 9b0e131b83cfc44d3132bddfefb6cbd4bff7d253 (diff) |
Add a series of migrations changing the model-level design of protected branch access levels.
1. Remove the `developers_can_push` and `developers_can_merge` boolean
columns.
2. Add two new tables, `protected_branches_push_access`, and
`protected_branches_merge_access`. Each row of these 'access' tables is
linked to a protected branch, and uses a `access_level` column to
figure out settings for the protected branch.
3. The `access_level` column is intended to be used with rails' `enum`,
with `:masters` at index 0 and `:developers` at index 1.
4. Doing it this way has a few advantages:
- Cleaner path to planned EE features where a protected branch is
accessible only by certain users or groups.
- Rails' `enum` doesn't allow a declaration like this due to the
duplicates. This approach doesn't have this problem.
enum can_be_pushed_by: [:masters, :developers]
enum can_be_merged_by: [:masters, :developers]
Diffstat (limited to 'db/migrate/20160705054952_add_protected_branches_merge_access.rb')
-rw-r--r-- | db/migrate/20160705054952_add_protected_branches_merge_access.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20160705054952_add_protected_branches_merge_access.rb b/db/migrate/20160705054952_add_protected_branches_merge_access.rb new file mode 100644 index 00000000000..9f82c0a8aa3 --- /dev/null +++ b/db/migrate/20160705054952_add_protected_branches_merge_access.rb @@ -0,0 +1,15 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddProtectedBranchesMergeAccess < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + def change + create_table :protected_branch_merge_access_levels do |t| + t.references :protected_branch, index: { name: "index_protected_branch_merge_access" }, foreign_key: true, null: false + t.integer :access_level, default: 0, null: false + + t.timestamps null: false + end + end +end |