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-b9f4589650da
unstable
Mike Smith 2010-09-17 16:12:27 +00:00
parent d0ea92d35f
commit 2b891db0e1
1 changed files with 1 additions and 1 deletions

View File

@ -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