X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/4708992f1c9e03596d3f9cfe1965c39affe93b56..758e6da9a80e2e53a171ebc3119f813f8ff4141c:/db/migrate/044_create_user_roles.rb?ds=inline diff --git a/db/migrate/044_create_user_roles.rb b/db/migrate/044_create_user_roles.rb index 10ec3ee7b..0db3ea77e 100644 --- a/db/migrate/044_create_user_roles.rb +++ b/db/migrate/044_create_user_roles.rb @@ -1,4 +1,4 @@ -require 'lib/migrate' +require 'migrate' class CreateUserRoles < ActiveRecord::Migration def self.up @@ -11,7 +11,7 @@ class CreateUserRoles < ActiveRecord::Migration end add_column :user_roles, :role, :user_role_enum, :null => false - User.all(:conditions => ['administrator = ?', true]).each do |user| + User.where(:administrator => true).each do |user| UserRole.create(:user_id => user.id, :role => "administrator") end remove_column :users, :administrator @@ -21,7 +21,7 @@ class CreateUserRoles < ActiveRecord::Migration def self.down add_column :users, :administrator, :boolean, :default => false, :null => false - UserRole.all(:conditions => ['role = ?', "administrator"]).each do |role| + UserRole.where(:role => "administrator").each do |role| user = User.find(role.user_id) user.administrator = true user.save!