Class: CreateUsers

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/double_auth_engine/generators/double_auth_engine/templates/user_migration.rb

Class Method Summary collapse

Class Method Details

.downObject



25
26
27
# File 'lib/double_auth_engine/generators/double_auth_engine/templates/user_migration.rb', line 25

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
# File 'lib/double_auth_engine/generators/double_auth_engine/templates/user_migration.rb', line 2

def self.up
  create_table :users do |t|
    t.string :email, :null => false
    t.string :name, :null => false, :limit => 100
    t.string :location, :limit => 150
    t.string :crypted_password, :null => false
    t.string :password_salt, :null => false
    t.string :persistence_token, :null => false
    t.string :single_access_token, :null => false
    t.string :perishable_token, :null => false
    t.integer :login_count, :null => false, :default => 0
    t.integer :failed_login_count, :null => false, :default => 0
    t.datetime :last_request_at
    t.datetime :current_login_at
    t.datetime :last_login_at
    t.string :current_login_ip
    t.string :last_login_ip
    t.timestamps
  end
  add_index :users, :email, :unique => true
  add_index :users, :perishable_token
end