Skip to content

Instantly share code, notes, and snippets.

@yamaaki
Created July 31, 2015 06:09
Show Gist options
  • Save yamaaki/74040a640f18e4c98c38 to your computer and use it in GitHub Desktop.
Save yamaaki/74040a640f18e4c98c38 to your computer and use it in GitHub Desktop.
class DeviseCreateAdmins < ActiveRecord::Migration
def change
create_table(:admins) do |t|
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
t.string :unlock_token # Only if unlock strategy is :email or :both
t.datetime :locked_at
t.timestamps null: false
end
add_index :admins, :email, unique: true
add_index :admins, :unlock_token, unique: true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment