From d5b8c1e12b0b42929eb17c464ceb0fe05eb14631 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 25 May 2010 21:36:56 +0000 Subject: [PATCH] Attempt at changing postgres as per r66892 OverlordQ or someone, can you review please? --- maintenance/postgres/archives/patch-rename-iwl_prefix.sql | 2 ++ maintenance/postgres/tables.sql | 2 +- maintenance/updaters.inc | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 maintenance/postgres/archives/patch-rename-iwl_prefix.sql diff --git a/maintenance/postgres/archives/patch-rename-iwl_prefix.sql b/maintenance/postgres/archives/patch-rename-iwl_prefix.sql new file mode 100644 index 0000000000..ebe0abcb1e --- /dev/null +++ b/maintenance/postgres/archives/patch-rename-iwl_prefix.sql @@ -0,0 +1,2 @@ +DROP INDEX iwl_prefix; +CREATE INDEX iwl_prefix_from_title ON iwlinks (iwl_prefix, iwl_from, iwl_title); \ No newline at end of file diff --git a/maintenance/postgres/tables.sql b/maintenance/postgres/tables.sql index 0f8ae56725..1f6e95fe88 100644 --- a/maintenance/postgres/tables.sql +++ b/maintenance/postgres/tables.sql @@ -622,4 +622,4 @@ CREATE TABLE iwlinks ( iwl_title TEXT NOT NULL DEFAULT '' ); CREATE UNIQUE INDEX iwl_from ON iwlinks (iwl_from, iwl_prefix, iwl_title); -CREATE INDEX iwl_prefix ON iwlinks (iwl_prefix, iwl_title); +CREATE INDEX iwl_prefix_from_title ON iwlinks (iwl_prefix, iwl_from, iwl_title); diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 8674addebc..f06b71e10d 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -1966,6 +1966,12 @@ function do_postgres_updates() { wfOut( "Adding ipb_address_unique index\n" ); $wgDatabase->sourceFile( archive( 'patch-ipb_address_unique.sql' ) ); } + + # Fix iwlinks index + if ( pg_index_exists( 'iwlinks', 'iwl_prefix' ) ) { + wfOut( "Replacing index 'iwl_prefix' with 'iwl_prefix_from_title'...\n" ); + $wgDatabase->sourceFile( archive( 'patch-ipb_address_unique.sql' ) ); + } global $wgExtNewTables, $wgExtPGNewFields, $wgExtPGAlteredFields, $wgExtNewIndexes; # Add missing extension tables -- 2.20.1