2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/generators/relational_audit/templates/create_relational_audits.rb', line 2
def change
create_table :audits do |t|
t.string :entity_type, :null => false
t.integer :entity_id, :null => false
t.string :event, :null => false
t.string :changes_by
t.text :entity_changes
t.string :transaction_id
t.datetime :created_at
end
create_table :audit_relations do |t|
t.integer :audit_id
t.string :relation_type
t.integer :relation_id
t.datetime :created_at
end
add_index :audits, [:entity_type, :entity_id]
add_index :audit_relations, [:audit_id, :relation_id]
end
|