Skip to content

Commit

Permalink
Remove default values pointing to functions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mat128 committed Jun 29, 2017
1 parent a7fe15d commit a65360d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pg2mysql.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit a65360d

Please sign in to comment.