summaryrefslogtreecommitdiff
path: root/maintenance/postgres
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
commit63601400e476c6cf43d985f3e7b9864681695ed4 (patch)
treef7846203a952e38aaf66989d0a4702779f549962 /maintenance/postgres
parent8ff01378c9e0207f9169b81966a51def645b6a51 (diff)
Update to MediaWiki 1.20.2
this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'maintenance/postgres')
-rw-r--r--maintenance/postgres/archives/patch-add_interwiki.sql14
-rw-r--r--maintenance/postgres/archives/patch-category.sql4
-rw-r--r--maintenance/postgres/archives/patch-external_user.sql6
-rw-r--r--maintenance/postgres/archives/patch-ipb_address_unique.sql1
-rw-r--r--maintenance/postgres/archives/patch-log_search.sql2
-rw-r--r--maintenance/postgres/archives/patch-module_deps.sql2
-rw-r--r--maintenance/postgres/archives/patch-msg_resource.sql2
-rw-r--r--maintenance/postgres/archives/patch-msg_resource_links.sql2
-rw-r--r--maintenance/postgres/compare_schemas.pl35
-rw-r--r--maintenance/postgres/tables.sql7
10 files changed, 59 insertions, 16 deletions
diff --git a/maintenance/postgres/archives/patch-add_interwiki.sql b/maintenance/postgres/archives/patch-add_interwiki.sql
new file mode 100644
index 00000000..6c08af7a
--- /dev/null
+++ b/maintenance/postgres/archives/patch-add_interwiki.sql
@@ -0,0 +1,14 @@
+DROP FUNCTION IF EXISTS add_interwiki(TEXT,INT,CHARACTER) CASCADE;
+CREATE OR REPLACE FUNCTION "add_interwiki" (TEXT,INT,SMALLINT) RETURNS INT LANGUAGE SQL AS
+$mw$
+ INSERT INTO interwiki (iw_prefix, iw_url, iw_local) VALUES ($1,$2,$3);
+ SELECT 1;
+$mw$;
+
+DROP FUNCTION IF EXISTS add_interwiki(TEXT,INT,CHARACTER) CASCADE;
+CREATE OR REPLACE FUNCTION "add_interwiki" (TEXT,INT,SMALLINT) RETURNS INT LANGUAGE SQL AS
+$mw$
+ INSERT INTO interwiki (iw_prefix, iw_url, iw_local) VALUES ($1,$2,$3);
+ SELECT 1;
+$mw$;
+
diff --git a/maintenance/postgres/archives/patch-category.sql b/maintenance/postgres/archives/patch-category.sql
index 5e0d620f..266b1d00 100644
--- a/maintenance/postgres/archives/patch-category.sql
+++ b/maintenance/postgres/archives/patch-category.sql
@@ -1,8 +1,8 @@
-CREATE SEQUENCE category_id_seq;
+CREATE SEQUENCE category_cat_id_seq;
CREATE TABLE category (
- cat_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('category_id_seq'),
+ cat_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('category_cat_id_seq'),
cat_title TEXT NOT NULL,
cat_pages INTEGER NOT NULL DEFAULT 0,
cat_subcats INTEGER NOT NULL DEFAULT 0,
diff --git a/maintenance/postgres/archives/patch-external_user.sql b/maintenance/postgres/archives/patch-external_user.sql
new file mode 100644
index 00000000..6058a706
--- /dev/null
+++ b/maintenance/postgres/archives/patch-external_user.sql
@@ -0,0 +1,6 @@
+CREATE TABLE external_user (
+ eu_local_id INTEGER NOT NULL PRIMARY KEY,
+ eu_external_id TEXT
+);
+
+CREATE UNIQUE INDEX eu_external_id ON external_user (eu_external_id);
diff --git a/maintenance/postgres/archives/patch-ipb_address_unique.sql b/maintenance/postgres/archives/patch-ipb_address_unique.sql
index e618f99c..e69de29b 100644
--- a/maintenance/postgres/archives/patch-ipb_address_unique.sql
+++ b/maintenance/postgres/archives/patch-ipb_address_unique.sql
@@ -1 +0,0 @@
-CREATE UNIQUE INDEX ipb_address_unique ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only);
diff --git a/maintenance/postgres/archives/patch-log_search.sql b/maintenance/postgres/archives/patch-log_search.sql
index 20a61fd7..4c0b3c61 100644
--- a/maintenance/postgres/archives/patch-log_search.sql
+++ b/maintenance/postgres/archives/patch-log_search.sql
@@ -5,5 +5,5 @@ CREATE TABLE log_search (
ls_log_id INTEGER NOT NULL DEFAULT 0
);
-ALTER TABLE log_search ADD CONSTRAINT log_search_pk PRIMARY KEY(ls_field, ls_value, ls_log_id);
+ALTER TABLE log_search ADD CONSTRAINT log_search_pkey PRIMARY KEY(ls_field, ls_value, ls_log_id);
CREATE INDEX ls_log_id ON log_search (ls_log_id);
diff --git a/maintenance/postgres/archives/patch-module_deps.sql b/maintenance/postgres/archives/patch-module_deps.sql
index 703dcdaf..bd7bb1f0 100644
--- a/maintenance/postgres/archives/patch-module_deps.sql
+++ b/maintenance/postgres/archives/patch-module_deps.sql
@@ -4,4 +4,4 @@ CREATE TABLE module_deps (
md_deps TEXT NOT NULL
);
-CREATE UNIQUE INDEX md_module_skin_idx ON module_deps (md_module, md_skin);
+CREATE UNIQUE INDEX md_module_skin ON module_deps (md_module, md_skin);
diff --git a/maintenance/postgres/archives/patch-msg_resource.sql b/maintenance/postgres/archives/patch-msg_resource.sql
index 00d82073..68756d1a 100644
--- a/maintenance/postgres/archives/patch-msg_resource.sql
+++ b/maintenance/postgres/archives/patch-msg_resource.sql
@@ -5,4 +5,4 @@ CREATE TABLE msg_resource (
mr_timestamp TIMESTAMPTZ NOT NULL
);
-CREATE UNIQUE INDEX mr_resource_lang_idx ON msg_resource (mr_resource, mr_lang);
+CREATE UNIQUE INDEX mr_resource_lang ON msg_resource (mr_resource, mr_lang);
diff --git a/maintenance/postgres/archives/patch-msg_resource_links.sql b/maintenance/postgres/archives/patch-msg_resource_links.sql
index e7b80219..88109da3 100644
--- a/maintenance/postgres/archives/patch-msg_resource_links.sql
+++ b/maintenance/postgres/archives/patch-msg_resource_links.sql
@@ -3,4 +3,4 @@ CREATE TABLE msg_resource_links (
mrl_message TEXT NOT NULL
);
-CREATE UNIQUE INDEX mrl_message_resource_idx ON msg_resource_links (mrl_message, mrl_resource);
+CREATE UNIQUE INDEX mrl_message_resource ON msg_resource_links (mrl_message, mrl_resource);
diff --git a/maintenance/postgres/compare_schemas.pl b/maintenance/postgres/compare_schemas.pl
index 18210fcf..53aeb147 100644
--- a/maintenance/postgres/compare_schemas.pl
+++ b/maintenance/postgres/compare_schemas.pl
@@ -38,7 +38,7 @@ while (<DATA>) {
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
@@ -94,7 +94,7 @@ sub parse_sql {
next if /^\s*\-\-/ or /^\s+$/;
s/\s*\-\- [\w ]+$//;
chomp;
-
+
if (/CREATE\s*TABLE/i) {
if (m{^CREATE TABLE /\*_\*/(\w+) \($}) {
$table = $1;
@@ -158,16 +158,17 @@ for my $table (sort keys %{$old{$oldfile}}) {
}
}
-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*$/;
@@ -182,6 +183,11 @@ while (<$newfh>) {
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;
@@ -233,6 +239,7 @@ my $COLMAP = q{
## INTS:
tinyint SMALLINT
int INTEGER SERIAL
+smallint SMALLINT
bigint BIGINT
real NUMERIC
float NUMERIC
@@ -276,6 +283,9 @@ rc_log_type varbinary(255) TEXT
## 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
@@ -298,8 +308,13 @@ log_params blob TEXT # LF separated list of args
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
@@ -316,12 +331,17 @@ qc_type varbinary(32) 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
@@ -434,6 +454,9 @@ for my $t (sort keys %{$old{$oldfile}}) {
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";
}
diff --git a/maintenance/postgres/tables.sql b/maintenance/postgres/tables.sql
index 6890df91..3ac19cb4 100644
--- a/maintenance/postgres/tables.sql
+++ b/maintenance/postgres/tables.sql
@@ -36,7 +36,6 @@ CREATE TABLE mwuser ( -- replace reserved word 'user'
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
@@ -278,12 +277,14 @@ CREATE TABLE ipblocks (
ipb_range_end TEXT,
ipb_deleted SMALLINT NOT NULL DEFAULT 0,
ipb_block_email SMALLINT NOT NULL DEFAULT 0,
- ipb_allow_usertalk SMALLINT NOT NULL DEFAULT 0
+ ipb_allow_usertalk SMALLINT NOT NULL DEFAULT 0,
+ ipb_parent_block_id INTEGER NULL REFERENCES ipblocks(ipb_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
);
CREATE UNIQUE INDEX ipb_address_unique ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only);
CREATE INDEX ipb_user ON ipblocks (ipb_user);
CREATE INDEX ipb_range ON ipblocks (ipb_range_start,ipb_range_end);
+CREATE INDEX ipb_parent_block_id ON ipblocks (ipb_parent_block_id);
CREATE TABLE image (
@@ -378,7 +379,7 @@ CREATE TABLE uploadstash (
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);