2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/generators/simple_audit/migration/templates/active_record/migration.rb', line 2
def self.up
create_table :audits do |t|
t.belongs_to :auditable, :polymorphic => true
t.belongs_to :user, :polymorphic => true
t.string :username
t.string :action
t.text :change_log
t.timestamps
end
add_index :audits, [:auditable_id, :auditable_type], :name => 'auditable_index'
add_index :audits, [:user_id, :user_type], :name => 'user_index'
add_index :audits, :created_at
end
|