1 package DBIx::Class::Schema::Journal::DB::AuditLog;
3 use base 'DBIx::Class::Core';
5 sub journal_define_table {
6 my ( $class, $source, $schema_class ) = @_;
8 $class->table($source->name . '_audit_log');
10 # the create_id is the id of first insertion of the row
11 # so we always know where to roll back to
12 # and presumably should be supplied on every insert
16 data_type => 'integer',
21 data_type => 'integer',
27 foreach my $column ( $source->primary_columns ) {
28 $class->add_column( $column => { %{ $source->column_info($column) } } );
31 $class->set_primary_key( $source->primary_columns );
33 $class->belongs_to(created => "${schema_class}::ChangeLog", 'create_id');
34 $class->belongs_to(deleted => "${schema_class}::ChangeLog", 'delete_id');