Method: CreateWiserTrails.up

Defined in:
lib/generators/wiser_trails/migration/templates/migration.rb

.upObject

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.timestamps
  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