Commit | Line | Data |
8e52f1da |
1 | package MySchema::Foo; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use base qw( DBIx::Class ); |
7 | |
8 | __PACKAGE__->load_components( qw( DateTime::Epoch TimeStamp Core ) ); |
9 | __PACKAGE__->table( 'foo' ); |
10 | __PACKAGE__->add_columns( |
11 | id => { |
12 | data_type => 'bigint', |
13 | is_auto_increment => 1, |
14 | is_nullable => 0, |
15 | }, |
16 | name => { |
17 | data_type => 'varchar', |
18 | size => 10, |
19 | is_nullable => 1, |
20 | }, |
21 | bar => { # epoch stored as an int |
22 | data_type => 'bigint', |
23 | inflate_datetime => 1, |
24 | }, |
25 | baz => { # epoch stored as a string |
26 | data_type => 'varchar', |
27 | size => 50, |
28 | inflate_datetime => 'epoch', |
29 | }, |
30 | # working in conjunction with DBIx::Class::TimeStamp |
31 | creation_time => { |
32 | data_type => 'bigint', |
33 | inflate_datetime => 1, |
34 | set_on_create => 1, |
35 | }, |
36 | modification_time => { |
37 | data_type => 'bigint', |
38 | inflate_datetime => 1, |
39 | set_on_create => 1, |
40 | set_on_update => 1, |
41 | } |
42 | ); |
43 | |
44 | __PACKAGE__->set_primary_key( 'id' ); |
45 | |
46 | 1; |