Sha256: b68cfb73830979391fa6ee09c8d9dc5287d7c69edc50736f7114bc2d4fc28971

Contents?: true

Size: 497 Bytes

Versions: 12

Compression:

Stored size: 497 Bytes

Contents

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

  def down
    drop_table :recommendable_likes
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
recommendable-1.1.7 db/migrate/20120124193723_create_likes.rb
recommendable-1.1.6 db/migrate/20120124193723_create_likes.rb
recommendable-1.1.5 db/migrate/20120124193723_create_likes.rb
recommendable-1.1.4 db/migrate/20120124193723_create_likes.rb
recommendable-1.1.3 db/migrate/20120124193723_create_likes.rb
recommendable-1.1.2 db/migrate/20120124193723_create_likes.rb
recommendable-1.1.1 db/migrate/20120124193723_create_likes.rb
recommendable-1.0.0 db/migrate/20120124193723_create_likes.rb
recommendable-0.2.1.1 db/migrate/20120124193723_create_likes.rb
recommendable-0.1.8 db/migrate/20120124193723_create_likes.rb
recommendable-0.1.6 db/migrate/20120124193723_create_likes.rb
recommendable-0.1.5 db/migrate/20120124193723_create_likes.rb