--- mysql2pgsql 2000/03/06 07:13:23 1.1 +++ mysql2pgsql 2000/04/25 13:48:56 1.2 @@ -11,6 +11,7 @@ # 1999-12-26 DbP don't make serial from auto_increment, create all manually # (to set start value right) # 2000-01-11 DbP now creates sequences with correct value +# 2000-04-25 DbP import into CVS (at cvs.linux.hr) use DBI; @@ -93,11 +94,21 @@ # nuke date representation (not supported in PostgreSQL) s/datetime default '[^']+'/datetime/i; + s/date default '[^']+'/datetime/i; + s/time default '[^']+'/datetime/i; # change not null datetime filend to null valid ones # (to support remapping of "zaro time" to null s/datetime not null/datetime/i; + # add unique to definition of type (MySQL separates this) + if (/unique \w+ \((\w+)\)/i) { + $sql=~s/($1)([^,]+)/$1$2 unique/gi; + next; + } + + } else { # not inside create table + #---- fix data in inserted data: (from MS world) # FIX: disabled for now if (00 && /insert into/i) { @@ -108,10 +119,10 @@ s!\x92!`!g; } - } else { # not inside create table - # fix dates '0000-00-00 00:00:00' (should be null) s/'0000-00-00 00:00:00'/null/gi; + s/'0000-00-00'/null/gi; + s/'00:00:00'/null/gi; } $sql.="$_";