diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-12-14 22:24:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-12-14 22:24:20 +0000 |
commit | 7c00a4a11fc33bb5016cb6b1e401a9ecf56dc3f5 (patch) | |
tree | 72f6cc21b4a0778703a4cb4f496a05f012ee6963 /db | |
parent | 7d2298f39c609ec79dd16f27ef69885a7c390d00 (diff) | |
download | redmine-7c00a4a11fc33bb5016cb6b1e401a9ecf56dc3f5.tar.gz redmine-7c00a4a11fc33bb5016cb6b1e401a9ecf56dc3f5.zip |
Restores migration broken by r8182 and removes default scope on Role (#9800).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8213 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/020_add_role_position.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/db/migrate/020_add_role_position.rb b/db/migrate/020_add_role_position.rb index 0012833fe..48ac89a36 100644 --- a/db/migrate/020_add_role_position.rb +++ b/db/migrate/020_add_role_position.rb @@ -1,7 +1,7 @@ class AddRolePosition < ActiveRecord::Migration def self.up add_column :roles, :position, :integer, :default => 1 - Role.update_all("position = (SELECT COUNT(*) FROM #{Role.table_name} r WHERE r.id < id) + 1") + Role.all.each_with_index {|role, i| role.update_attribute(:position, i+1)} end def self.down |