[Bast-commits] r8404 -
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Fri Jan 22 06:19:19 GMT 2010
Author: caelum
Date: 2010-01-22 06:19:19 +0000 (Fri, 22 Jan 2010)
New Revision: 8404
Modified:
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm
Log:
better handling of default precision for TIME type in Pg
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm 2010-01-22 05:42:50 UTC (rev 8403)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm 2010-01-22 06:19:19 UTC (rev 8404)
@@ -147,8 +147,26 @@
WHERE table_name = ? and column_name = ?
EOF
- if ((not $precision) || $precision !~ /^\d/
- || ($data_type !~ /^time\b/i && $precision == 6)) { # only interval/timestamp default to precision == 6
+ if ($data_type =~ /^time\b/i) {
+ if ((not $precision) || $precision !~ /^\d/) {
+ delete $result->{$col}{size};
+ }
+ else {
+ my ($integer_datetimes) = $self->schema->storage->dbh
+ ->selectrow_array('show integer_datetimes');
+
+ my $max_precision =
+ $integer_datetimes =~ /^on\z/i ? 6 : 10;
+
+ if ($precision == $max_precision) {
+ delete $result->{$col}{size};
+ }
+ else {
+ $result->{$col}{size} = $precision;
+ }
+ }
+ }
+ elsif ((not $precision) || $precision !~ /^\d/ || $precision == 6) {
delete $result->{$col}{size};
}
else {
More information about the Bast-commits
mailing list