Commit | Line | Data |
f0f14c64 |
1 | package DBIx::Class::Schema::Journal::DB::ChangeSet; |
2 | |
34b144a0 |
3 | use base 'DBIx::Class::Core'; |
f0f14c64 |
4 | |
5b64dcdc |
5 | sub journal_define_table { |
6 | my ( $class, $schema_class, $prefix ) = @_; |
b34c6936 |
7 | |
5b64dcdc |
8 | $class->load_components(qw/InflateColumn::DateTime/); |
9 | $class->table($prefix . 'changeset'); |
b34c6936 |
10 | |
5b64dcdc |
11 | $class->add_columns( |
b34c6936 |
12 | ID => { |
13 | data_type => 'integer', |
14 | is_auto_increment => 1, |
15 | is_primary_key => 1, |
16 | is_nullable => 0, |
17 | }, |
18 | user_id => { |
19 | data_type => 'integer', |
20 | is_nullable => 1, |
21 | is_foreign_key => 1, |
22 | }, |
23 | set_date => { |
24 | data_type => 'timestamp', |
25 | is_nullable => 0, |
26 | }, |
27 | session_id => { |
28 | data_type => 'varchar', |
29 | size => 255, |
30 | is_nullable => 1, |
31 | }, |
5b64dcdc |
32 | ); |
b34c6936 |
33 | |
5b64dcdc |
34 | $class->set_primary_key('ID'); |
35 | } |
f0f14c64 |
36 | |
cf628f4c |
37 | sub new { |
38 | my $self = shift->next::method(@_); |
5b64dcdc |
39 | # I think we should not do the following and |
40 | # instead use DBIx::Class::TimeStamp. If I |
41 | # can think of a good way (passing a version on |
42 | # import?) to do it and retain backcompat I will. |
43 | # |
44 | # --fREW, 01-27-2010 |
b34c6936 |
45 | $self->set_date(scalar gmtime); |
cf628f4c |
46 | return $self; |
47 | } |
48 | |
f0f14c64 |
49 | 1; |