Add migration to make user.admin required

Revert r10296, which was a bad idea because it did not fix the problem if the
original version of the migration had already been applied.

git-svn-id: file:///home/svn/framework3/trunk@10333 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Mike Smith 2010-09-16 17:29:14 +00:00
parent 9dae361383
commit 6eed30a78d
2 changed files with 16 additions and 1 deletions

View File

@ -2,7 +2,7 @@ class AddUserAdmin < ActiveRecord::Migration
# Add user admin flag and project member list.
def self.up
add_column :users, :admin, :boolean, :null => false, :default => true
add_column :users, :admin, :boolean, :default => true
create_table :project_members, :id => false do |t|
t.integer :workspace_id, :null => false

View File

@ -0,0 +1,15 @@
class RequireAdminFlag < ActiveRecord::Migration
# Make the admin flag required.
def self.up
# update any existing records
User.find_each { |u| u.admin = true if u.admin.nil? }
change_column :users, :admin, :boolean, :null => false, :default => true
end
def self.down
change_column :users, :admin, :boolean, :default => true
end
end