Sha256: 484bfb1f1d15537ca936ecc2c4dc05b3ff15e7a09c74ec25989b4f83a038ac29

Contents?: true

Size: 427 Bytes

Versions: 3

Compression:

Stored size: 427 Bytes

Contents

class CreateLikes < ActiveRecord::Migration
  def up
    create_table :likes do |t|
      t.references :user
      t.references :likeable, :polymorphic => true
      t.timestamps
    end
    
    add_index :likes, :likeable_id
    add_index :likes, :likeable_type
    add_index :likes, [:user_id, :likeable_id, :likeable_type], :unique => true, :name => "user_like_constraint"
  end

  def down
    drop_table :likes
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
recommendable-0.1.4 db/migrate/20120124193723_create_likes.rb
recommendable-0.1.3 db/migrate/20120124193723_create_likes.rb
recommendable-0.1.2 db/migrate/20120124193723_create_likes.rb