Class: MyFeedsMigration

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

Instance Method Summary collapse

Instance Method Details

#changeObject


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/generators/templates/feeds_migration.rb', line 2

def change
  create_table :feeds do |t|
    #necessarily
    t.references :source, :polymorphic => true, :null => false
    t.string :source_identity, null: false
    t.string :event, null: false

    #not necessarily, but maybe you need
    #you can also customize your columns
    t.references :target, :polymorphic => true

    t.timestamps
  end

  add_index :feeds, :source_identity
end