RT56175: allow tables to have a prefix
[dbsrgits/DBIx-Class-Journal.git] / lib / DBIx / Class / Schema / Journal / DB / ChangeSet.pm
CommitLineData
f0f14c64 1package DBIx::Class::Schema::Journal::DB::ChangeSet;
2
34b144a0 3use base 'DBIx::Class::Core';
f0f14c64 4
5b64dcdc 5sub journal_define_table {
6 my ( $class, $schema_class, $prefix ) = @_;
7
8 $class->load_components(qw/InflateColumn::DateTime/);
9 $class->table($prefix . 'changeset');
10
11 $class->add_columns(
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 },
32 );
33
34 $class->set_primary_key('ID');
35}
f0f14c64 36
cf628f4c 37sub 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
9a52f4b4 45 $self->set_date(gmtime);
cf628f4c 46 return $self;
47}
48
f0f14c64 491;