summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-05-10 10:54:31 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-05-10 10:54:31 +0000
commit7dccf9fda6f30d8f4b0c5eaad9f6e2a1e67cd643 (patch)
treeba6a18abff6ca69af528b3d295263d049a22266f /db
parent814e138c2a1105f8d9d10c4362a889dd71aff32d (diff)
downloadredmine-7dccf9fda6f30d8f4b0c5eaad9f6e2a1e67cd643.tar.gz
redmine-7dccf9fda6f30d8f4b0c5eaad9f6e2a1e67cd643.zip
Allows multiple roles on the same project (#706). Prerequisite for user groups feature.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2726 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20090503121501_create_member_roles.rb12
-rw-r--r--db/migrate/20090503121505_populate_member_roles.rb11
-rw-r--r--db/migrate/20090503121510_drop_members_role_id.rb9
3 files changed, 32 insertions, 0 deletions
diff --git a/db/migrate/20090503121501_create_member_roles.rb b/db/migrate/20090503121501_create_member_roles.rb
new file mode 100644
index 000000000..38519ea7c
--- /dev/null
+++ b/db/migrate/20090503121501_create_member_roles.rb
@@ -0,0 +1,12 @@
+class CreateMemberRoles < ActiveRecord::Migration
+ def self.up
+ create_table :member_roles do |t|
+ t.column :member_id, :integer, :null => false
+ t.column :role_id, :integer, :null => false
+ end
+ end
+
+ def self.down
+ drop_table :member_roles
+ end
+end
diff --git a/db/migrate/20090503121505_populate_member_roles.rb b/db/migrate/20090503121505_populate_member_roles.rb
new file mode 100644
index 000000000..8b7c98750
--- /dev/null
+++ b/db/migrate/20090503121505_populate_member_roles.rb
@@ -0,0 +1,11 @@
+class PopulateMemberRoles < ActiveRecord::Migration
+ def self.up
+ Member.find(:all).each do |member|
+ MemberRole.create!(:member_id => member.id, :role_id => member.role_id)
+ end
+ end
+
+ def self.down
+ MemberRole.delete_all
+ end
+end
diff --git a/db/migrate/20090503121510_drop_members_role_id.rb b/db/migrate/20090503121510_drop_members_role_id.rb
new file mode 100644
index 000000000..c28119910
--- /dev/null
+++ b/db/migrate/20090503121510_drop_members_role_id.rb
@@ -0,0 +1,9 @@
+class DropMembersRoleId < ActiveRecord::Migration
+ def self.up
+ remove_column :members, :role_id
+ end
+
+ def self.down
+ raise IrreversibleMigration
+ end
+end