[Dbix-class] set_on_create problem

Steve steve at matsch.com
Wed Apr 25 18:51:05 GMT 2012


Hello,

I have set up a user table both 'updatedon' and 'createdon' fields.  
They are of type Datetime (MySQL).  My entire schema was autogenerated 
by DBIC::Loader script with the 'components=TimeStamp' directive.  I 
have confirmed that the resultset loads the "InflateColumn::DateTime" 
component, and included the:

__PACKAGE__->add_columns( 'createdon',{ %{ 
__PACKAGE__->column_info('createdon') }, set_on_create => 1, } );

directive.  If I understand this correctly...  any time I create a new 
user, this field should be populated with the current (system) time, but 
it is not.

I am using HTML::FormHandler, and so have gotten 'around' this (bit of a 
pun here in case you missed it) with a moose method modifier.  This is a 
kludge, and I would like to fix it by having DBIx::Class take care of it 
for me.

Can anyone tell me what I'm missing, or if more info is needed?

Thanks,
Steve



More information about the DBIx-Class mailing list