my $datatype = join '|' => qw(
bool
-tinyint int bigint real float
+tinyint smallint int bigint real float
tinytext mediumtext text char varchar varbinary binary
timestamp datetime
tinyblob mediumblob blob
next if /^\s*\-\-/ or /^\s+$/;
s/\s*\-\- [\w ]+$//;
chomp;
-
+
if (/CREATE\s*TABLE/i) {
if (m{^CREATE TABLE /\*_\*/(\w+) \($}) {
$table = $1;
}
}
-my $dtype = join '|' => qw(
+my $dtypelist = join '|' => qw(
SMALLINT INTEGER BIGINT NUMERIC SERIAL
TEXT CHAR VARCHAR
BYTEA
TIMESTAMPTZ
CIDR
);
-$dtype = qr{($dtype)};
+my $dtype = qr{($dtypelist)};
my %new;
my ($infunction,$inview,$inrule,$lastcomma) = (0,0,0,0);
+my %custom_type;
seek $newfh, 0, 0;
while (<$newfh>) {
next if /^\s*\-\-/ or /^\s*$/;
next if /^DROP SEQUENCE/;
next if /^DROP FUNCTION/;
+ if (/^CREATE TYPE (\w+)/) {
+ die "Type $1 declared more than once!\n" if $custom_type{$1}++;
+ $dtype = qr{($dtypelist|$1)};
+ next;
+ }
chomp;
## INTS:
tinyint SMALLINT
int INTEGER SERIAL
+smallint SMALLINT
bigint BIGINT
real NUMERIC
float NUMERIC
## Simple text-only strings:
ar_flags tinyblob TEXT
+cf_name varbinary(255) TEXT
+cf_value blob TEXT
+ar_sha1 varbinary(32) TEXT
cl_collation varbinary(32) TEXT
cl_sortkey varbinary(230) TEXT
ct_params blob TEXT
log_type varbinary(10) TEXT
ls_field varbinary(32) TEXT
md_deps mediumblob TEXT # JSON
+md_module varbinary(255) TEXT
+md_skin varbinary(32) TEXT
mr_blob mediumblob TEXT # JSON
mr_lang varbinary(32) TEXT
+mr_resource varbinary(255) TEXT
+mrl_message varbinary(255) TEXT
+mrl_resource varbinary(255) TEXT
oi_minor_mime varbinary(100) TEXT
oi_sha1 varbinary(32) TEXT
old_flags tinyblob TEXT
qcc_type varbinary(32) TEXT
qci_type varbinary(32) TEXT
rc_params blob TEXT
+rev_sha1 varbinary(32) TEXT
rlc_to_blob blob TEXT
ts_tags blob TEXT
-ug_group varbinary(16) TEXT
+ufg_group varbinary(32) TEXT
+ug_group varbinary(32) TEXT
ul_value blob TEXT
-up_property varbinary(32) TEXT
+up_property varbinary(255) TEXT
up_value blob TEXT
+us_sha1 varchar(31) TEXT
+us_source_type varchar(50) TEXT
+us_status varchar(50) TEXT
user_email_token binary(32) TEXT
user_ip varbinary(40) TEXT
user_newpassword tinyblob TEXT
next if exists $colmapok{$c}{$old}{$new};
$old =~ s/ENUM.*/ENUM/;
+
+ next if $old eq 'ENUM' and $new eq 'media_type';
+
if (! exists $colmap{$old}{$new}) {
print "Column types for $t.$c do not match: $old does not map to $new\n";
}
user_email_token TEXT,
user_email_token_expires TIMESTAMPTZ,
user_email_authenticated TIMESTAMPTZ,
- user_options TEXT,
user_touched TIMESTAMPTZ,
user_registration TIMESTAMPTZ,
user_editcount INTEGER
us_media_type media_type DEFAULT NULL,
us_image_width INTEGER,
us_image_height INTEGER,
- us_image_bits INTEGER
+ us_image_bits SMALLINT
);
CREATE INDEX us_user_idx ON uploadstash (us_user);
md_deps TEXT NOT NULL
);
CREATE UNIQUE INDEX md_module_skin ON module_deps (md_module, md_skin);
+
+CREATE TABLE config (
+ cf_name TEXT NOT NULL PRIMARY KEY,
+ cf_value TEXT NOT NULL
+);
+CREATE INDEX cf_name_value ON config (cf_name, cf_value);