Skip Menu |

This queue is for tickets about the DBIx-Class-TimeStamp CPAN distribution.

Report information
The Basics
Id: 85674
Status: new
Priority: 0/
Queue: DBIx-Class-TimeStamp

People
Owner: Nobody in particular
Requestors: hobbit [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.14
Fixed in: (no value)



Subject: Problems with multiple tagged columns
I'm using DBIx::Class::Timestamp for implementing a pair of fields in my table. The fields, called created_on and modified_on should represent a creation date and a modification date. Thus, I have something like that in my Result class: __PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); __PACKAGE__->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, "title", { data_type => "varchar", is_nullable => 0, size => 255 }, "description", { data_type => "text", is_nullable => 0 }, "created_on", { data_type => "datetime", datetime_undef_if_invalid => 1, is_nullable => 0, set_on_create => 1, }, "modified_on", { data_type => "datetime", datetime_undef_if_invalid => 1, is_nullable => 0, set_on_create => 1, set_on_update => 1, }, ); After creation of an entry in the corresponding table, and prior to any update, I'd expect to have identical created_on and modified_on fields. However, this do not happens every time. Because of the way DBIx::DyamicDefault works, get_timestamp is called two times, one for each column, and this can (and will using HiRes time) give two different values. Worst, given how DBIx::DyamicDefault determines the order in which to apply the dynamic defaults, we could have modified_on < created_on for a newly created object.