Class: CreateChanges
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateChanges
- Defined in:
- lib/generators/historyable/templates/migration.rb
Instance Method Summary collapse
Instance Method Details
#down ⇒ Object
13 14 15 |
# File 'lib/generators/historyable/templates/migration.rb', line 13 def down drop_table :changes end |
#up ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/generators/historyable/templates/migration.rb', line 2 def up create_table :changes do |t| t.references :item, polymorphic: true t.string :object_attribute t.text :object_attribute_value t.datetime :created_at end add_index :changes, [:item_type, :item_id] end |