Class: DeviseCreateUsers

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/chapter07/begin/templates/db/migrate/20110608224650_devise_create_users.rb

Class Method Summary collapse

Class Method Details

.downObject



26
27
28
# File 'lib/generators/chapter07/begin/templates/db/migrate/20110608224650_devise_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/chapter07/begin/templates/db/migrate/20110608224650_devise_create_users.rb', line 2

def self.up
  create_table(:users) do |t|
    t.database_authenticatable :null => false
    t.recoverable
    t.rememberable
    t.trackable

    # t.encryptable
    # t.confirmable
    # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
    # t.token_authenticatable

    t.string :name

    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, :unlock_token,         :unique => true
  # add_index :users, :authentication_token, :unique => true
end