Class: CreateActivities

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

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/protocolist/install/templates/migration.rb', line 2

def change
  create_table :activities do |t|
    t.references :actor,  polymorphic: true
    t.references :target, polymorphic: true

    t.string :activity_type
    t.text :data

    t.timestamps
  end
  add_index :activities, [:actor_id, :actor_type]
  add_index :activities, [:target_id, :target_type]
end