Sha256: 6b1b6bb744f5a04698b53034537200cf09040bfe65c37a32d4318ce6253bffde

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

class LikesMigration < ActiveRecord::Migration
  def change
    create_table :likes do |t|
      #this table must have xxx_identity, xxx_id, xxx_type 3 columns
      t.string :likeable_identity, null: false
      t.references :likeable, :polymorphic => true, :null => false

      #you maybe need change this column
      t.references :user

      t.timestamps
    end

    #indexes
    #add_index :likes, [:user_id, :likeable_id, :likeable_type], :unique => true
    #add_index :likes, :user_id
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
my_feeds-1.0.0 lib/generators/templates/likes_migration.rb