wiki.techinc.nl/maintenance/sqlite/archives/patch-querycache-qc_title-varbinary.sql
Amir Sarabadani 77f11539c2 Migrate querycache to abstract schema
Turning qc_title to varbinary in MySQL to make it consistent with the
rest of fields.

For Postgres:
 - Setting 0 as default for qc_value and qc_namespace
 - Changing data type of qc_namespace from SMALLINT to INT to make it
   the same with MySQL/Sqlite
 - Renaming index to make it the same with other schemas
 - Setting empty string as default of qc_title

Bug: T230428
Bug: T164898
Change-Id: I81527121609014d29182ae735a2c1f532d7d4d2a
2020-09-26 15:52:43 +02:00

14 lines
446 B
SQL

CREATE TABLE /*_*/querycache_tmp (
qc_type BLOB NOT NULL,
qc_value INTEGER UNSIGNED DEFAULT 0 NOT NULL,
qc_namespace INTEGER DEFAULT 0 NOT NULL,
qc_title BLOB DEFAULT '' NOT NULL
);
INSERT INTO /*_*/querycache_tmp
SELECT qc_type, qc_value, qc_namespace, qc_title
FROM /*_*/querycache;
DROP TABLE /*_*/querycache;
ALTER TABLE /*_*/querycache_tmp RENAME TO /*_*/querycache;
CREATE INDEX qc_type ON /*_*/querycache (qc_type, qc_value);