rewrite datetime defaults as CURRENT_TIMESTAMP to ease cross-deployment
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBI / Pg.pm
index b089a04..b89fe95 100644 (file)
@@ -201,8 +201,9 @@ EOF
             delete $result->{$col}{default_value};
         }
 
-# alias now() to current_timestamp for deploying to other DBs
-        if (eval { lc ${ $result->{$col}{default_value} } eq 'now()' }) {
+# alias now() to CURRENT_TIMESTAMP for deploying to other DBs
+        if (eval { lc ${ $result->{$col}{default_value} }||'' eq 'now()' }) {
+            # do not use a ref to a constant, that breaks Data::Dump output
             ${$result->{$col}{default_value}} = 'CURRENT_TIMESTAMP';
         }
     }