-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
-- Source: maintenance/abstractSchemaChanges/patch-pagelinks-target_id.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TEMPORARY TABLE /*_*/__temp__pagelinks AS
SELECT  pl_from,  pl_namespace,  pl_title,  pl_from_namespace
FROM  /*_*/pagelinks;
DROP  TABLE  /*_*/pagelinks;
CREATE TABLE  /*_*/pagelinks (    pl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,    pl_namespace INTEGER DEFAULT 0 NOT NULL,    pl_title BLOB DEFAULT '' NOT NULL,    pl_from_namespace INTEGER DEFAULT 0 NOT NULL,    pl_target_id BIGINT UNSIGNED DEFAULT NULL,    PRIMARY KEY(pl_from, pl_namespace, pl_title)  );
INSERT INTO  /*_*/pagelinks (    pl_from, pl_namespace, pl_title, pl_from_namespace  )
SELECT  pl_from,  pl_namespace,  pl_title,  pl_from_namespace
FROM  /*_*/__temp__pagelinks;
DROP  TABLE /*_*/__temp__pagelinks;
CREATE INDEX pl_namespace ON  /*_*/pagelinks (pl_namespace, pl_title, pl_from);
CREATE INDEX pl_backlinks_namespace ON  /*_*/pagelinks (    pl_from_namespace, pl_namespace,    pl_title, pl_from  );
CREATE INDEX pl_target_id ON  /*_*/pagelinks (pl_target_id, pl_from);
CREATE INDEX pl_backlinks_namespace_target_id ON  /*_*/pagelinks (    pl_from_namespace, pl_target_id,    pl_from  );