Class: SimpleTokenAuthMigration

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

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/generators/templates/migration.rb', line 2

def change
  create_table :api_keys do |t|
    t.integer :token_authenticatable_id,  null: false
    t.string :token_authenticatable_type, null: false
    t.string :access_token,               null: false
    t.datetime :expired_at
    t.datetime :created_at
  end
  add_index :api_keys, :access_token, unique: true
end