Class: CreateAuthentications

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/gunnertechnology/project/templates/db/migrate/create_authentications.rb

Class Method Summary collapse

Class Method Details

.downObject



18
19
20
# File 'lib/generators/gunnertechnology/project/templates/db/migrate/create_authentications.rb', line 18

def self.down
  drop_table :authentications
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/gunnertechnology/project/templates/db/migrate/create_authentications.rb', line 2

def self.up
  create_table :authentications do |t|
    t.references :authenticationable, :polymorphic => true
    t.string :provider, :null => false, :limit => 64
    t.string :uid, :null => false, :limit => 128
    t.string :nickname, :limit => 64, :null => false
    t.string :token, :limit => 128
    t.string :secret, :limit => 128
    t.timestamps
  end
  
  add_index :authentications, [:authenticationable_id, :authenticationable_type], :name => "index_authentications_on_a_id_a_type"
  add_index :authentications, :provider
  add_index :authentications, [:provider, :authenticationable_type, :uid], :name => "index_authentications_on_p_a_type_uid"
end