Subject: | Datetime field recognition |
In the method DBIx::Class::TimeStamp->add_columns when checking for the
appropriate data_type of the column the following regex is used.
/^(datetime|date|timestamp)$/
I was having problems getting the module to function properly until I
looked at this code and realized that my data_type assignments in all my
Class->add_columns calls are in uppercase. Such as:
__PACKAGE__->add_columns(
"created_at",
{
data_type => "DATETIME", # <- UPPERCASE doesn't work
default_value => "0000-00-00 00:00:00",
is_nullable => 0,
size => 19,
set_on_create => 1,
});
Apparently, this case of the data_type value is carried through,
therefore causing the regex filter to ignore the column. When I changed
my data_type value to be lowercase, it worked.
__PACKAGE__->add_columns(
"created_at",
{
data_type => "datetime", # This works!
default_value => "0000-00-00 00:00:00",
is_nullable => 0,
size => 19,
set_on_create => 1,
});
The data_type recognition filter should do some case conversion.
Also, worth mentioning is that most all of my DBIx class files are
generated using DBIx::Class::SchemaLoader and have the data_type
declared in uppercase.
Thanks so much for a convenient and easy module.
perl: v5.8.8
os: Kubuntu Edgy 6.10 (2.6.17-11-generic)
v/r
-Matt Pitts