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-b9f4589650daunstable
parent
9dae361383
commit
6eed30a78d
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue