Class: CreateTrackableEvents
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateTrackableEvents
- Defined in:
- lib/generators/tracker_jacker/migration/templates/migration.rb
Overview
Migration responsible for creating trackable events
Instance Method Summary collapse
Instance Method Details
#change ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/tracker_jacker/migration/templates/migration.rb', line 3 def change create_table :trackable_events do |t| t.belongs_to :trackable, :polymorphic => true t.belongs_to :owner, :polymorphic => true t.string :category t.string :event t.text :new_value t.text :old_value t. null: false end add_index :trackable_events, [:trackable_id, :trackable_type] add_index :trackable_events, [:owner_id, :owner_type] end |