Class: CreateFollows

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

Instance Method Summary collapse

Instance Method Details

#changeObject


2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/socialization/templates/active_record/migration_follows.rb', line 2

def change
  create_table :follows do |t|
    t.string  :follower_type
    t.integer :follower_id
    t.string  :followable_type
    t.integer :followable_id
    t.datetime :created_at
  end

  add_index :follows, ["follower_id", "follower_type"],     :name => "fk_follows"
  add_index :follows, ["followable_id", "followable_type"], :name => "fk_followables"
end