From 4cb78de05fd1d1e7ad40716e350d8bc3200b751a Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Fri, 10 Oct 2008 18:24:02 +0000 Subject: [PATCH] Quick fix to index dropping, without using IF EXISTS clause, per bug #15896 --- maintenance/postgres/archives/patch-ipb_address_unique.sql | 1 - maintenance/updaters.inc | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/maintenance/postgres/archives/patch-ipb_address_unique.sql b/maintenance/postgres/archives/patch-ipb_address_unique.sql index 9cfc6318c0..e618f99ccf 100644 --- a/maintenance/postgres/archives/patch-ipb_address_unique.sql +++ b/maintenance/postgres/archives/patch-ipb_address_unique.sql @@ -1,2 +1 @@ -DROP INDEX IF EXISTS ipb_address; CREATE UNIQUE INDEX ipb_address_unique ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only); diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 5fb054602e..f58fe7b71f 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -1703,9 +1703,14 @@ function do_postgres_updates() { } # Fix ipb_address index + if (pg_index_exists('ipblocks', 'ipb_address' )) { + echo "Removing deprecated index 'ipb_address'...\n"; + $wgDatabase->query('DROP INDEX ipb_address'); + } if (pg_index_exists('ipblocks', 'ipb_address_unique' )) { echo "... have ipb_address_unique\n"; - } else { + } + else { echo "Adding ipb_address_unique index\n"; dbsource(archive('patch-ipb_address_unique.sql')); } -- 2.20.1