wiki.techinc.nl/maintenance/sqlite/archives/patch-templatelinks-tl_title-nullable.sql
Amir Sarabadani 692dde00df Add support for write new for templatelinks migration
- schema change to allow tl_namespace and tl_title being empty
   This is done by removing them from primary key. They don't need to be
   nullable as they have default value.
 - Make sure with WRITE_NEW, updater avoids writing to the old columns

Bug: T306674
Change-Id: I2b8a29043e952060e7a79b6a7a3d647d48cd16fb
2022-07-12 14:46:54 +02:00

21 lines
No EOL
1.5 KiB
SQL

-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
-- Source: maintenance/abstractSchemaChanges/patch-templatelinks-tl_title-nullable.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
DROP INDEX tl_namespace;
DROP INDEX tl_backlinks_namespace;
DROP INDEX tl_target_id;
DROP INDEX tl_backlinks_namespace_target_id;
CREATE TEMPORARY TABLE /*_*/__temp__templatelinks AS
SELECT tl_from, tl_namespace, tl_title, tl_from_namespace, tl_target_id
FROM /*_*/templatelinks;
DROP TABLE /*_*/templatelinks;
CREATE TABLE /*_*/templatelinks ( tl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL, tl_target_id BIGINT UNSIGNED NOT NULL, tl_namespace INTEGER DEFAULT 0 NOT NULL, tl_title BLOB DEFAULT '' NOT NULL, tl_from_namespace INTEGER DEFAULT 0 NOT NULL, PRIMARY KEY(tl_from, tl_target_id) );
INSERT INTO /*_*/templatelinks ( tl_from, tl_namespace, tl_title, tl_from_namespace, tl_target_id )
SELECT tl_from, tl_namespace, tl_title, tl_from_namespace, tl_target_id
FROM /*_*/__temp__templatelinks;
DROP TABLE /*_*/__temp__templatelinks;
CREATE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, tl_from);
CREATE INDEX tl_backlinks_namespace ON /*_*/templatelinks ( tl_from_namespace, tl_namespace, tl_title, tl_from );
CREATE INDEX tl_target_id ON /*_*/templatelinks (tl_target_id, tl_from);
CREATE INDEX tl_backlinks_namespace_target_id ON /*_*/templatelinks ( tl_from_namespace, tl_target_id, tl_from );