From 6b3529aa1396a1f5655a7616c0c711c8561cdfee Mon Sep 17 00:00:00 2001 From: Jacob Coby Date: Fri, 26 Mar 2010 13:35:43 -0400 Subject: [PATCH] default 0000-00-00 00:00:00 datetime columns to 'epoch' --- mysql2psql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mysql2psql b/mysql2psql index 8f69b1a..a161ee3 100755 --- a/mysql2psql +++ b/mysql2psql @@ -385,6 +385,10 @@ EOF if column[:type] == "char" row[index] = row[index] == 1 ? 't' : row[index] == 0 ? 'f' : row[index] end + # give a default for zeroed datetimes + if column[:type] == "datetime" and row[index] == '0000-00-00 00:00:00' + row[index] = 'epoch' + end if row[index].is_a?(String) if column[:type] == "bytea" row[index] = PGconn.quote(row[index]) -- 2.1.4