Class: ActsAsLikeableMigration

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

Class Method Summary collapse

Class Method Details

.upObject



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

def self.up
  create_table :likes do |t|
    t.references :likeable, :polymorphic => true
    t.references :liker, :polymorphic => true

    t.timestamps
  end

  add_index :likes, [:likeable_id, :likeable_type]
  add_index :likes, [:liker_id, :liker_type]
end