Migrate querycache_info to abstract schema
Additional changes for Postgres: - Set empty string as default for qci_type - Set PG-equivalent of the given MySql/Sqlite timestamp as default timestamp for qci_timestamp - Make qci_type non nullable - Make qci_timestamp non nullable - Drop UNIQUE constraint on qci_type Bug: T230428 Bug: T164898 Depends-On: If344395615087c360597a5b3d66ea03e930b7d9b Change-Id: I741d2d079696d4b4eba09945341054d2a145bddc
This commit is contained in:
parent
639239001d
commit
6599e5706c
8 changed files with 49 additions and 16 deletions
|
|
@ -767,6 +767,11 @@ class PostgresUpdater extends DatabaseUpdater {
|
|||
[ 'setDefault', 'user_groups', 'ug_group', '' ],
|
||||
[ 'renameIndex', 'user_groups', 'user_groups_group', 'ug_group' ],
|
||||
[ 'renameIndex', 'user_groups', 'user_groups_expiry', 'ug_expiry' ],
|
||||
[ 'setDefault', 'querycache_info', 'qci_type', '' ],
|
||||
[ 'setDefault', 'querycache_info', 'qci_timestamp', '1970-01-01 00:00:00+00' ],
|
||||
[ 'changeNullableField', 'querycache_info', 'qci_type', 'NOT NULL', true ],
|
||||
[ 'changeNullableField', 'querycache_info', 'qci_timestamp', 'NOT NULL', true ],
|
||||
[ 'addIndex', 'querycache_info', 'querycache_info_pkey', 'patch-querycache_info-pk.sql' ],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE querycache_info
|
||||
DROP CONSTRAINT querycache_info_qci_type_key,
|
||||
ADD PRIMARY KEY (qci_type);
|
||||
|
|
@ -340,3 +340,10 @@ CREATE TABLE user_groups (
|
|||
CREATE INDEX ug_group ON user_groups (ug_group);
|
||||
|
||||
CREATE INDEX ug_expiry ON user_groups (ug_expiry);
|
||||
|
||||
|
||||
CREATE TABLE querycache_info (
|
||||
qci_type TEXT DEFAULT '' NOT NULL,
|
||||
qci_timestamp TIMESTAMPTZ DEFAULT '1970-01-01 00:00:00+00' NOT NULL,
|
||||
PRIMARY KEY(qci_type)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -428,11 +428,6 @@ CREATE TABLE interwiki (
|
|||
);
|
||||
|
||||
|
||||
CREATE TABLE querycache_info (
|
||||
qci_type TEXT UNIQUE,
|
||||
qci_timestamp TIMESTAMPTZ NULL
|
||||
);
|
||||
|
||||
CREATE TABLE objectcache (
|
||||
keyname TEXT UNIQUE,
|
||||
value BYTEA NOT NULL DEFAULT '',
|
||||
|
|
|
|||
|
|
@ -326,3 +326,10 @@ CREATE TABLE /*_*/user_groups (
|
|||
CREATE INDEX ug_group ON /*_*/user_groups (ug_group);
|
||||
|
||||
CREATE INDEX ug_expiry ON /*_*/user_groups (ug_expiry);
|
||||
|
||||
|
||||
CREATE TABLE /*_*/querycache_info (
|
||||
qci_type BLOB DEFAULT '' NOT NULL,
|
||||
qci_timestamp BLOB DEFAULT '19700101000000' NOT NULL,
|
||||
PRIMARY KEY(qci_type)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -303,3 +303,10 @@ CREATE TABLE /*_*/user_groups (
|
|||
INDEX ug_expiry (ug_expiry),
|
||||
PRIMARY KEY(ug_user, ug_group)
|
||||
) /*$wgDBTableOptions*/;
|
||||
|
||||
|
||||
CREATE TABLE /*_*/querycache_info (
|
||||
qci_type VARBINARY(32) DEFAULT '' NOT NULL,
|
||||
qci_timestamp BINARY(14) DEFAULT '19700101000000' NOT NULL,
|
||||
PRIMARY KEY(qci_type)
|
||||
) /*$wgDBTableOptions*/;
|
||||
|
|
|
|||
|
|
@ -1003,5 +1003,25 @@
|
|||
{ "name": "ug_expiry", "columns": [ "ug_expiry" ], "unique": false }
|
||||
],
|
||||
"pk": [ "ug_user", "ug_group"]
|
||||
},
|
||||
{
|
||||
"name": "querycache_info",
|
||||
"comment": "Details of updates to cached special pages",
|
||||
"columns": [
|
||||
{
|
||||
"name": "qci_type",
|
||||
"comment": "Special page name. Corresponds to a qc_type value",
|
||||
"type": "binary",
|
||||
"options": { "length": 32, "notnull": true, "default": "" }
|
||||
},
|
||||
{
|
||||
"name": "qci_timestamp",
|
||||
"comment": "Timestamp of last update",
|
||||
"type": "mwtimestamp",
|
||||
"options": { "length": 14, "notnull": true, "default": "19700101000000" }
|
||||
}
|
||||
],
|
||||
"indexes": [],
|
||||
"pk": [ "qci_type" ]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1191,17 +1191,6 @@ CREATE INDEX /*i*/job_cmd ON /*_*/job (job_cmd, job_namespace, job_title, job_pa
|
|||
CREATE INDEX /*i*/job_timestamp ON /*_*/job (job_timestamp);
|
||||
|
||||
|
||||
-- Details of updates to cached special pages
|
||||
CREATE TABLE /*_*/querycache_info (
|
||||
-- Special page name
|
||||
-- Corresponds to a qc_type value
|
||||
qci_type varbinary(32) NOT NULL default '' PRIMARY KEY,
|
||||
|
||||
-- Timestamp of last update
|
||||
qci_timestamp binary(14) NOT NULL default '19700101000000'
|
||||
) /*$wgDBTableOptions*/;
|
||||
|
||||
|
||||
-- Protected titles - nonexistent pages that have been protected
|
||||
CREATE TABLE /*_*/protected_titles (
|
||||
pt_namespace int NOT NULL,
|
||||
|
|
|
|||
Loading…
Reference in a new issue