Commit | Line | Data |
d27ed438 |
1 | package DBIx::Class::Schema::Journal::DB::AuditLog; |
2 | |
3 | use base 'DBIx::Class::Schema::Journal::DB::Base'; |
4 | |
5 | __PACKAGE__->add_columns( |
6 | ID => { |
7 | data_type => 'integer', |
8 | is_nullable => 0, |
9 | }, |
10 | create_id => { |
11 | data_type => 'integer', |
12 | is_nullable => 0, |
13 | is_foreign_key => 1, |
14 | }, |
15 | delete_id => { |
16 | data_type => 'integer', |
17 | is_nullable => 1, |
18 | is_foreign_key => 1, |
19 | }); |
20 | __PACKAGE__->belongs_to('created', 'DBIx::Class::Schema::Journal::DB::Change', 'create_id'); |
21 | __PACKAGE__->belongs_to('deleted', 'DBIx::Class::Schema::Journal::DB::Change', 'delete_id'); |
22 | |
23 | sub new |
24 | { |
25 | my ($self, $data, @rest) = @_; |
26 | |
27 | $data->{created} = { |
28 | changeset_id => $self->result_source->schema->_journal_schema->current_changeset, |
29 | }; |
30 | |
31 | $self->next::method($data, @rest); |
32 | } |
33 | |
34 | 1; |