From 0aa59e34015845b1f122ce79fc745f0394b8ea8d Mon Sep 17 00:00:00 2001 From: OverlordQ Date: Fri, 30 Oct 2009 00:14:13 +0000 Subject: [PATCH] Followup to r58263, update newcolumns, fix newsequences check, minor formatting update to PG section --- maintenance/updaters.inc | 68 ++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 45 deletions(-) diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 40d9376b16..71103aff04 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -1329,14 +1329,12 @@ function do_log_search_population() { } /*********************************************************************** - * Start PG crap + * Start PG stuff * TODO: merge with above ***********************************************************************/ -function -pg_describe_table($table) -{ -global $wgDatabase, $wgDBmwschema; +function pg_describe_table($table) { + global $wgDatabase, $wgDBmwschema; $q = <<selectField("pg_indexes", "indexname", array( "indexname" => $index, "tablename" => $table, @@ -1421,19 +1415,8 @@ global $wgDatabase, $wgDBmwschema; return $exists === $index; } -function -pg_sequence_exists($seq) -{ -global $wgDatabase, $wgDBmwschema; - $exists = $wgDatabase->selectField("pg_class","relname", - array( "relname" => $seq ) ); - return $exists === $seq; -} - -function -pg_fkey_deltype($fkey) -{ -global $wgDatabase, $wgDBmwschema; +function pg_fkey_deltype($fkey) { + global $wgDatabase, $wgDBmwschema; $q = <<sequenceExists($ns)) { - wfOut( "... sequence \"$ns\" already exists\n" ); + if( $wgDatabase->sequenceExists('pr_id_val') ) { + wfOut( "Updating sequence names\n" ); + $wgDatabase->sourceFile(archive('patch-update_sequences.sql')); continue; + } elseif ( $wgDatabase->sequenceExists('page_restrictions_pr_id_seq') ) { + wfOut( "... sequences already updated\n" ); + continue; + } else { + wfOut( "Creating sequence \"$ns\"\n" ); + $wgDatabase->query("CREATE SEQUENCE $ns"); } - - wfOut( "Creating sequence \"$ns\"\n" ); - $wgDatabase->query("CREATE SEQUENCE $ns"); } foreach ($newtables as $nt) { @@ -1859,14 +1845,6 @@ function do_postgres_updates() { $wgDatabase->sourceFile(archive('patch-revision_rev_user_fkey.sql')); } - #Update sequence names - if (pg_sequence_exists('page_restrictions_pr_id_seq')) { - wfOut( "... sequences already updated\n" ); - } else { - wfOut( "Updating sequence names\n" ); - $wgDatabase->sourceFile(archive('patch-update_sequences.sql')); - } - # Fix ipb_address index if (pg_index_exists('ipblocks', 'ipb_address' )) { wfOut( "Removing deprecated index 'ipb_address'...\n" ); -- 2.20.1