Class: CreateLikes

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/socialization/templates/active_record/migration_likes.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_likes.rb', line 2

def change
  create_table :likes do |t|
    t.string  :liker_type
    t.integer :liker_id
    t.string  :likeable_type
    t.integer :likeable_id
    t.datetime :created_at
  end

  add_index :likes, ["liker_id", "liker_type"],       :name => "fk_likes"
  add_index :likes, ["likeable_id", "likeable_type"], :name => "fk_likeables"
end