Migrate updatelog to abstract schema

And fixing the schema drift between mysql and postgres in this table by
changing field type of ul_key and ul_value from TEXT and TEXT to
VARCHAR(255) and BYTEA respectively.

The automatic generation is done with running generateSchemaSql.php
maintenance script. More info:
https://www.mediawiki.org/wiki/Manual:Schema_changes#Automatically_generated

Bug: T230428
Bug: T164898
Change-Id: Id785539d32546166d6f7a5c3cb1924f4841a2963
This commit is contained in:
Amir Sarabadani 2020-05-10 03:57:16 +02:00
parent 27244468d6
commit c1578fa017
7 changed files with 37 additions and 13 deletions

View file

@ -689,6 +689,8 @@ class PostgresUpdater extends DatabaseUpdater {
[ 'dropPgField', 'archive', 'ar_text_id' ],
[ 'dropPgField', 'archive', 'ar_content_model' ],
[ 'dropPgField', 'archive', 'ar_content_format' ],
[ 'changeField', 'updatelog', 'ul_key', 'varchar(255)', '' ],
[ 'changeField', 'updatelog', 'ul_value', 'BYTEA', '' ],
];
}

View file

@ -2,3 +2,8 @@
-- Source: maintenance/tables.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE updatelog (
ul_key VARCHAR(255) NOT NULL,
ul_value BYTEA DEFAULT NULL,
PRIMARY KEY(ul_key)
);

View file

@ -731,12 +731,6 @@ CREATE TABLE protected_titles (
PRIMARY KEY (pt_namespace, pt_title)
);
CREATE TABLE updatelog (
ul_key TEXT NOT NULL PRIMARY KEY,
ul_value TEXT
);
CREATE SEQUENCE category_cat_id_seq;
CREATE TABLE category (
cat_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('category_cat_id_seq'),

View file

@ -2,3 +2,8 @@
-- Source: maintenance/tables.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/updatelog (
ul_key VARCHAR(255) NOT NULL,
ul_value BLOB DEFAULT NULL,
PRIMARY KEY(ul_key)
);

View file

@ -2,3 +2,8 @@
-- Source: maintenance/tables.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/updatelog (
ul_key VARCHAR(255) NOT NULL,
ul_value BLOB DEFAULT NULL,
PRIMARY KEY(ul_key)
) /*$wgDBTableOptions*/;

View file

@ -1 +1,20 @@
[]
[
{
"name": "updatelog",
"comment": "A table to log updates, one text key row per update.",
"columns": [
{
"name": "ul_key",
"type": "string",
"options": { "length": 255, "notnull": true }
},
{
"name": "ul_value",
"type": "blob",
"options": { "length": 65530, "notnull": false }
}
],
"indexes": [],
"pk": [ "ul_key" ]
}
]

View file

@ -1724,12 +1724,6 @@ CREATE TABLE /*_*/page_props (
CREATE UNIQUE INDEX /*i*/pp_propname_page ON /*_*/page_props (pp_propname,pp_page);
CREATE UNIQUE INDEX /*i*/pp_propname_sortkey_page ON /*_*/page_props (pp_propname,pp_sortkey,pp_page);
-- A table to log updates, one text key row per update.
CREATE TABLE /*_*/updatelog (
ul_key varchar(255) NOT NULL PRIMARY KEY,
ul_value blob
) /*$wgDBTableOptions*/;
-- A table to track tags for revisions, logs and recent changes.
CREATE TABLE /*_*/change_tag (