wiki.techinc.nl/maintenance/sqlite/archives/patch-categorylinks-cl_to-varbinary.sql
Amir Sarabadani f9ccfa7cef Bring back timestamp time of cl_timestamp instead of binary(14)
Fixing this is going to be complicated. We have to first turn this into
varbinary(20), write a maintenance script to fix the values, then make sure
mediawiki work properly with two value types at the same time and then
turning it to binary(14).

For now, let's unblock 1.36 release, we will follow up on fixing this
for good later.

Bug: T270032
Change-Id: Iabbe8f085812acd90536a06fee2ecd4db9b047d5
2021-01-01 13:23:59 +00:00

28 lines
949 B
SQL

CREATE TABLE /*_*/categorylinks_tmp (
cl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
cl_to BLOB DEFAULT '' NOT NULL,
cl_sortkey BLOB DEFAULT '' NOT NULL,
cl_sortkey_prefix BLOB DEFAULT '' NOT NULL,
cl_timestamp DATETIME NOT NULL,
cl_collation BLOB DEFAULT '' NOT NULL,
cl_type TEXT DEFAULT 'page' NOT NULL,
PRIMARY KEY(cl_from, cl_to)
);
INSERT INTO /*_*/categorylinks_tmp (cl_from, cl_to, cl_sortkey, cl_sortkey_prefix, cl_timestamp, cl_collation, cl_type)
SELECT cl_from, cl_to, cl_sortkey, cl_sortkey_prefix, cl_timestamp, cl_collation, cl_type
FROM /*_*/categorylinks;
DROP TABLE /*_*/categorylinks;
ALTER TABLE /*_*/categorylinks_tmp RENAME TO /*_*/categorylinks;
CREATE INDEX cl_sortkey ON /*_*/categorylinks (
cl_to, cl_type, cl_sortkey, cl_from
);
CREATE INDEX cl_timestamp ON /*_*/categorylinks (cl_to, cl_timestamp);
CREATE INDEX cl_collation_ext ON /*_*/categorylinks (
cl_collation, cl_to, cl_type, cl_from
);