[Dbix-class] set_on_create problem

Steve steve at matsch.com
Thu Apr 26 12:37:32 GMT 2012


Thank you very much!  As a follow up, is there a way to have 
DBIC::Loader add this component?  It seems like the 
'components=TimeStamp' would have been enough, but this is obviously not 
the case.


On 4/26/2012 2:43 AM, Peter Rabbitson wrote:
> Steve wrote:
>> 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?
>>
>
> You are missing https://metacpan.org/module/DBIx::Class::TimeStamp
>
> Cheers
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: 
> http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>
>



More information about the DBIx-Class mailing list