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 my %column_info = %{$source->column_info($column)};
29 delete $column_info{$_} for qw(
36 $class->add_column( $column => \%column_info );
39 $class->set_primary_key( $source->primary_columns );
41 $class->belongs_to(created => "${schema_class}::ChangeLog", 'create_id');
42 $class->belongs_to(deleted => "${schema_class}::ChangeLog", 'delete_id');