diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-01-31 20:57:01 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-01-31 20:57:01 +0000 |
commit | 671a0fa10161ead2ec0fef888710cf7d872b2f61 (patch) | |
tree | f7b9068afbc1d1e360106b9584cd88aa89f10ab1 /db/migrate/020_add_role_position.rb | |
parent | 99f006f2c959ce9d1e5136e950ca448cc92ec7c9 (diff) | |
download | redmine-671a0fa10161ead2ec0fef888710cf7d872b2f61.tar.gz redmine-671a0fa10161ead2ec0fef888710cf7d872b2f61.zip |
added the ability to set the sort order for roles
git-svn-id: http://redmine.rubyforge.org/svn/trunk@208 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate/020_add_role_position.rb')
-rw-r--r-- | db/migrate/020_add_role_position.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/db/migrate/020_add_role_position.rb b/db/migrate/020_add_role_position.rb new file mode 100644 index 000000000..3afa88193 --- /dev/null +++ b/db/migrate/020_add_role_position.rb @@ -0,0 +1,10 @@ +class AddRolePosition < ActiveRecord::Migration + def self.up + add_column :roles, :position, :integer, :default => 1, :null => false + Role.find(:all).each_with_index {|role, i| role.update_attribute(:position, i+1)} + end + + def self.down + remove_column :roles, :position + end +end |