just a tiny grammer fix to POD
[dbsrgits/DBIx-Class.git] / t / testlib / Log.pm
1 package # hide from PAUSE 
2     Log;
3
4 BEGIN { unshift @INC, './t/testlib'; }
5 use base 'MyBase';
6
7 use strict;
8 use Time::Piece::MySQL;
9 use POSIX;
10
11 __PACKAGE__->set_table();
12 __PACKAGE__->columns(All => qw/id message datetime_stamp/);
13 __PACKAGE__->has_a(
14         datetime_stamp => 'Time::Piece',
15         inflate        => 'from_mysql_datetime',
16         deflate        => 'mysql_datetime'
17 );
18
19 __PACKAGE__->add_trigger(before_create => \&set_dts);
20 __PACKAGE__->add_trigger(before_update => \&set_dts);
21
22 sub set_dts {
23         shift->datetime_stamp(
24                 POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime(time)));
25 }
26
27 sub create_sql {
28         return qq{
29     id             INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
30     message        VARCHAR(255),
31     datetime_stamp DATETIME
32   };
33 }
34
35 1;
36