Created
January 17, 2010 19:12
-
-
Save elricstorm/279520 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateUsers < ActiveRecord::Migration | |
def self.up | |
create_table "users", :force => true do |t| | |
t.string :login, :email, :remember_token, :first_name, :last_name, :limit => 100 | |
t.boolean :admin, :super | |
t.string :crypted_password, :limit => 40 | |
t.string :password_reset_code, :limit => 40 | |
t.string :salt, :limit => 40 | |
t.string :activation_code, :limit => 40 | |
t.datetime :remember_token_expires_at, :activated_at, :deleted_at, :created_at, :updated_at | |
t.string :state, :null => :no, :default => 'passive' | |
t.timestamps | |
end | |
add_index :users, :login, :unique => true | |
# Create a super user | |
User.create!(:login => 'suadmin', | |
:email => "[email protected]", | |
:first_name => 'Super', | |
:last_name => 'User', | |
:password => "your_admin_password", | |
:password_confirmation => "your_admin_password") | |
# Create a test user | |
User.create!(:login => 'testuser', | |
:email => "[email protected]", | |
:first_name => 'Test', | |
:last_name => 'User', | |
:password => "your_test_password", | |
:password_confirmation => "your_test_password") | |
# Activate accounts after observer calls | |
@suadmin = User.suadminmake(1) | |
@testuser = User.force_activate_now(2) | |
end | |
def self.down | |
drop_table "users" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment