Class: CreateRollbackerChangesTable

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

Class Method Summary collapse

Class Method Details

.downObject



19
20
21
# File 'lib/generators/rollbacker/migration/templates/migration.rb', line 19

def self.down
  drop_table :rollbacker_changes
end

.upObject



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

def self.up
  create_table :rollbacker_changes, :force => true do |t|
    t.column :rollbackable_id, :integer
    t.column :rollbackable_type, :string
    t.column :user_id, :integer
    t.column :user_type, :string
    t.column :action, :string
    t.column :rollbacked_changes, :text
    t.column :created_at, :datetime
    t.column :updated_at, :datetime
  end

  add_index :rollbacker_changes, [:rollbackable_id, :rollbackable_type], :name => 'rollbackable_index'
  add_index :rollbacker_changes, [:user_id, :user_type], :name => 'user_index'
  add_index :rollbacker_changes, :created_at
end