Class: CreateWiserTrails
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateWiserTrails
- Defined in:
- lib/generators/wiser_trails/migration/templates/migration.rb
Overview
Migration responsible for creating a table with trails
Class Method Summary collapse
-
.down ⇒ Object
Drop table.
-
.up ⇒ Object
Create table.
Class Method Details
.down ⇒ Object
Drop table
21 22 23 |
# File 'lib/generators/wiser_trails/migration/templates/migration.rb', line 21 def self.down drop_table :wiser_trails end |
.up ⇒ Object
Create table
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/generators/wiser_trails/migration/templates/migration.rb', line 4 def self.up create_table :wiser_trails do |t| t.belongs_to :trackable, :polymorphic => true t.belongs_to :account, :polymorphic => true t.belongs_to :owner, :polymorphic => true t.string :key t.text :old_value t.text :new_value t. end add_index :wiser_trails, [:trackable_id, :trackable_type] add_index :wiser_trails, [:account_id, :account_type] add_index :wiser_trails, [:owner_id, :owner_type] end |