Class: SunriseCreateUsers

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/sunrise/templates/migrate/create_users.rb

Class Method Summary collapse

Class Method Details

.downObject



26
27
28
# File 'lib/generators/sunrise/templates/migrate/create_users.rb', line 26

def self.down
  drop_table :users
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/sunrise/templates/migrate/create_users.rb', line 2

def self.up
  create_table(:users) do |t|
    t.string :name, :limit => 150
    # t.string :login, :limit => 20, :null => false
    
    t.database_authenticatable :null => false
    t.recoverable
    t.rememberable
    t.trackable
    t.confirmable
    t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :time
    t.encryptable
    # t.token_authenticatable

    t.timestamps
  end
  
  add_index :users, :email,                :unique => true
  add_index :users, :reset_password_token, :unique => true
  add_index :users, :confirmation_token,   :unique => true
  # add_index :users, :login,                :unique => true
  # add_index :users, :unlock_token,         :unique => true    
end