From a65360d1615f5a4b9369e22632d8ce821ccb1fdd Mon Sep 17 00:00:00 2001 From: Mathieu Mitchell Date: Wed, 28 Jun 2017 07:49:33 -0400 Subject: [PATCH] Remove default values pointing to functions Currently, default values pointing to functions are left as-is. This is a problem because this converter does not handle functions. This commit simply strips the default mention for those fields. --- pg2mysql.inc.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pg2mysql.inc.php b/pg2mysql.inc.php index 99cc2eb..268c0b3 100644 --- a/pg2mysql.inc.php +++ b/pg2mysql.inc.php @@ -233,6 +233,9 @@ function pg2mysql($input, $header=true) $line=str_replace(" timestamp DEFAULT now()"," timestamp DEFAULT CURRENT_TIMESTAMP",$line); $line=preg_replace("/ timestamp( NOT NULL)?(,|$)/",' timestamp DEFAULT 0${1}${2}',$line); + // Remove defaults pointing to functions + $line=preg_replace("/ DEFAULT .*\(\)/", "", $line); + if(strstr($line,"auto_increment")) { $field=getfieldname($line); $tbl_extra.=", PRIMARY KEY(`$field`)\n";