Class: CreateAuditLogEntries

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/audit_log/templates/migration.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



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

def change
  create_table :audit_log_entries do |t|
    t.string  :auditable_type
    t.bigint  :auditable_id
    t.string  :action
    t.json    :changed_data
    t.string  :reason
    t.string  :actor_type
    t.bigint  :actor_id
    t.timestamps
  end

  add_index :audit_log_entries, i[auditable_type auditable_id]
  add_index :audit_log_entries, i[actor_type actor_id]
end