11 |
# 1999-12-26 DbP don't make serial from auto_increment, create all manually |
# 1999-12-26 DbP don't make serial from auto_increment, create all manually |
12 |
# (to set start value right) |
# (to set start value right) |
13 |
# 2000-01-11 DbP now creates sequences with correct value |
# 2000-01-11 DbP now creates sequences with correct value |
14 |
|
# 2000-04-25 DbP import into CVS (at cvs.linux.hr) |
15 |
|
|
16 |
use DBI; |
use DBI; |
17 |
|
|
94 |
|
|
95 |
# nuke date representation (not supported in PostgreSQL) |
# nuke date representation (not supported in PostgreSQL) |
96 |
s/datetime default '[^']+'/datetime/i; |
s/datetime default '[^']+'/datetime/i; |
97 |
|
s/date default '[^']+'/datetime/i; |
98 |
|
s/time default '[^']+'/datetime/i; |
99 |
|
|
100 |
# change not null datetime filend to null valid ones |
# change not null datetime filend to null valid ones |
101 |
# (to support remapping of "zaro time" to null |
# (to support remapping of "zaro time" to null |
102 |
s/datetime not null/datetime/i; |
s/datetime not null/datetime/i; |
103 |
|
|
104 |
|
# add unique to definition of type (MySQL separates this) |
105 |
|
if (/unique \w+ \((\w+)\)/i) { |
106 |
|
$sql=~s/($1)([^,]+)/$1$2 unique/gi; |
107 |
|
next; |
108 |
|
} |
109 |
|
|
110 |
|
} else { # not inside create table |
111 |
|
|
112 |
#---- fix data in inserted data: (from MS world) |
#---- fix data in inserted data: (from MS world) |
113 |
# FIX: disabled for now |
# FIX: disabled for now |
114 |
if (00 && /insert into/i) { |
if (00 && /insert into/i) { |
119 |
s!\x92!`!g; |
s!\x92!`!g; |
120 |
} |
} |
121 |
|
|
|
} else { # not inside create table |
|
|
|
|
122 |
# fix dates '0000-00-00 00:00:00' (should be null) |
# fix dates '0000-00-00 00:00:00' (should be null) |
123 |
s/'0000-00-00 00:00:00'/null/gi; |
s/'0000-00-00 00:00:00'/null/gi; |
124 |
|
s/'0000-00-00'/null/gi; |
125 |
|
s/'00:00:00'/null/gi; |
126 |
} |
} |
127 |
|
|
128 |
$sql.="$_"; |
$sql.="$_"; |