summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2011-12-07 01:27:07 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2011-12-07 01:27:07 +0200
commitcb021e58314791c1c9eb8035ed01349876d246a1 (patch)
tree3bebdf541af2967e2d5096f3c5c60ac24dd03240 /db
parent2ca00bdb3e07e84a87c6d480d8cb896bf6f08ca9 (diff)
downloadgitlab-ce-cb021e58314791c1c9eb8035ed01349876d246a1.tar.gz
repo & project access separated. critical gitolite bugfix
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20111206213842_add_advanced_rights_to_team_member.rb6
-rw-r--r--db/migrate/20111206222316_migrate_to_new_rights.rb20
-rw-r--r--db/schema.rb7
3 files changed, 29 insertions, 4 deletions
diff --git a/db/migrate/20111206213842_add_advanced_rights_to_team_member.rb b/db/migrate/20111206213842_add_advanced_rights_to_team_member.rb
new file mode 100644
index 00000000000..e2695fdafa7
--- /dev/null
+++ b/db/migrate/20111206213842_add_advanced_rights_to_team_member.rb
@@ -0,0 +1,6 @@
+class AddAdvancedRightsToTeamMember < ActiveRecord::Migration
+ def change
+ add_column :users_projects, :repo_access, :integer, :default => 0, :null => false
+ add_column :users_projects, :project_access, :integer, :default => 0, :null => false
+ end
+end
diff --git a/db/migrate/20111206222316_migrate_to_new_rights.rb b/db/migrate/20111206222316_migrate_to_new_rights.rb
new file mode 100644
index 00000000000..22e0c1ce994
--- /dev/null
+++ b/db/migrate/20111206222316_migrate_to_new_rights.rb
@@ -0,0 +1,20 @@
+class MigrateToNewRights < ActiveRecord::Migration
+ def up
+ # Repository access
+ UsersProject.update_all("repo_access = 2", :write => true)
+ UsersProject.update_all("repo_access = 1", :read => true, :write => false)
+
+ # Project access
+ UsersProject.update_all("project_access = 1", :read => true, :write => false, :admin => false)
+ UsersProject.update_all("project_access = 2", :read => true, :write => true, :admin => false)
+ UsersProject.update_all("project_access = 3", :read => true, :write => true, :admin => true)
+
+ # Remove old fields
+ remove_column :users_projects, :read
+ remove_column :users_projects, :write
+ remove_column :users_projects, :admin
+ end
+
+ def down
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8ffd874c7b7..fd50bf32c52 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20111127155345) do
+ActiveRecord::Schema.define(:version => 20111206222316) do
create_table "features", :force => true do |t|
t.string "name"
@@ -137,11 +137,10 @@ ActiveRecord::Schema.define(:version => 20111127155345) do
create_table "users_projects", :force => true do |t|
t.integer "user_id", :null => false
t.integer "project_id", :null => false
- t.boolean "read", :default => false
- t.boolean "write", :default => false
- t.boolean "admin", :default => false
t.datetime "created_at"
t.datetime "updated_at"
+ t.integer "repo_access", :default => 0, :null => false
+ t.integer "project_access", :default => 0, :null => false
end
end