From: hisaichi5518 Date: Tue, 18 Jun 2013 04:41:12 +0000 (+0900) Subject: added timezone warnings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f799a4b0c0118b5930e61c3b698a9cdd749c14d4;p=dbsrgits%2FDBIx-Class-Historic.git added timezone warnings --- diff --git a/lib/DBIx/Class/InflateColumn/DateTime.pm b/lib/DBIx/Class/InflateColumn/DateTime.pm index 3162223..007e7c0 100644 --- a/lib/DBIx/Class/InflateColumn/DateTime.pm +++ b/lib/DBIx/Class/InflateColumn/DateTime.pm @@ -160,6 +160,11 @@ sub register_column { } } + if ($info->{time_zone}) { + carp "Putting 'time_zone', ". + "please put 'timezone' Instead of 'time_zone' into the '$column' column definition."; + } + # shallow copy to avoid unfounded(?) Devel::Cycle complaints my $infcopy = {%$info}; diff --git a/t/inflate/datetime_mysql.t b/t/inflate/datetime_mysql.t index a810810..86cca75 100644 --- a/t/inflate/datetime_mysql.t +++ b/t/inflate/datetime_mysql.t @@ -18,6 +18,13 @@ plan skip_all => 'Inflation tests need ' . DBIx::Class::Optional::Dependencies-> DBICTest::Schema->load_classes('EventTZDeprecated'); } +{ + local $SIG{__WARN__} = sub { + like shift, qr/Putting 'time_zone', please put 'timezone' Instead of 'time_zone' into the 'starts_at' column definition\./; + }; + DBICTest::Schema->load_classes('EventTZWarning'); +} + my $schema = DBICTest->init_schema(); # Test "timezone" parameter