Commit | Line | Data |
d27ed438 |
1 | package DBIx::Class::Schema::Journal::DB::AuditLog; |
2 | |
3 | use base 'DBIx::Class::Schema::Journal::DB::Base'; |
c5fba518 |
4 | __PACKAGE__->table(__PACKAGE__->table); |
d27ed438 |
5 | |
6 | __PACKAGE__->add_columns( |
7 | ID => { |
8 | data_type => 'integer', |
8092c4ed |
9 | # is_auto_increment => 1, |
d27ed438 |
10 | is_nullable => 0, |
11 | }, |
12 | create_id => { |
13 | data_type => 'integer', |
14 | is_nullable => 0, |
15 | is_foreign_key => 1, |
16 | }, |
17 | delete_id => { |
18 | data_type => 'integer', |
19 | is_nullable => 1, |
20 | is_foreign_key => 1, |
21 | }); |
1e996809 |
22 | __PACKAGE__->set_primary_key('ID'); |
23 | |
d27ed438 |
24 | __PACKAGE__->belongs_to('created', 'DBIx::Class::Schema::Journal::DB::Change', 'create_id'); |
25 | __PACKAGE__->belongs_to('deleted', 'DBIx::Class::Schema::Journal::DB::Change', 'delete_id'); |
26 | |
27 | sub new |
28 | { |
8092c4ed |
29 | my ($self, $data, @rest) = @_; |
30 | my $source = $data->{-result_source}; |
d27ed438 |
31 | |
f3602465 |
32 | $data->{created} = { |
33 | # ID => \'DEFAULT', |
8092c4ed |
34 | # ID => 1, |
f4f0b7c9 |
35 | changeset_id => $source->schema->current_changeset, |
f5c237df |
36 | %{$data->{created}||{}}, |
d27ed438 |
37 | }; |
38 | |
8092c4ed |
39 | $self->next::method($data, @rest); |
d27ed438 |
40 | } |
41 | |
42 | 1; |