Sha256: db53254fe7d63632fe63054e0e4002c5d3febce400fa55fd4760c4a7e396c4c7

Contents?: true

Size: 506 Bytes

Versions: 3

Compression:

Stored size: 506 Bytes

Contents

class LikesMigration < ActiveRecord::Migration
  def change
    create_table :likes do |t|
      #this table must have xxx_identify, xxx_id, xxx_type 3 columns
      t.string :likeable_identify, 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

3 entries across 3 versions & 1 rubygems

Version Path
my_feeds-0.1.1 lib/rails/generators/templates/likes_migration.rb
my_feeds-0.1.0 lib/rails/generators/templates/likes_migration.rb
my_feeds-0.0.1 lib/rails/generators/templates/likes_migration.rb