Class: CreateAuditTrails

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

Class Method Summary collapse

Class Method Details

.downObject



13
14
15
# File 'lib/generators/audit_trail/templates/migration.rb', line 13

def self.down
  drop_table :change_events
end

.upObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/generators/audit_trail/templates/migration.rb', line 2

def self.up
  create_table(:change_events) do |t|
    t.integer :changed_object_id, :changed_by_id, :integer_value, :previous_integer_value
    t.string  :changed_object_type, :changed_attribute, :string_value, :previous_string_value, :additional_info, :changer_ip_address
    t.date    :date_value, :previous_date_value
    t.datetime :created_at, :datetime_value, :previous_datetime_value
    t.decimal  :decimal_value, :previous_decimal_value, :precision => 14, :scale => 2
    t.boolean  :boolean_value, :previous_boolean_value
  end
end