Use the fully-qualified name of the User class. Also, use a bulk UPDATE
instead of one UPDATE per record. git-svn-id: file:///home/svn/framework3/trunk@10348 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
d0ea92d35f
commit
2b891db0e1
|
@ -3,7 +3,7 @@ class RequireAdminFlag < ActiveRecord::Migration
|
||||||
# Make the admin flag required.
|
# Make the admin flag required.
|
||||||
def self.up
|
def self.up
|
||||||
# update any existing records
|
# update any existing records
|
||||||
User.find_each { |u| u.admin = true if u.admin.nil? }
|
Msf::DBManager::User.update_all({:admin => true}, {:admin => nil})
|
||||||
|
|
||||||
change_column :users, :admin, :boolean, :null => false, :default => true
|
change_column :users, :admin, :boolean, :null => false, :default => true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue