Upgrading from WP 2.8.6 to WP 2.9.1 now works with only 1 possible non-blocking error
git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@194612 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
@@ -255,6 +255,13 @@
|
||||
// LIMIT is not allowed in DELETE queries
|
||||
$sql = str_replace( 'LIMIT 1', '', $sql);
|
||||
$sql = str_replace( ' REGEXP ', ' ~ ', $sql);
|
||||
|
||||
// This handles removal of duplicate entries in table options
|
||||
if( false !== strpos( $sql, 'DELETE o1 FROM '))
|
||||
$sql = "DELETE FROM ${table_prefix}options WHERE option_id IN " .
|
||||
"(SELECT o1.option_id FROM ${table_prefix}options AS o1, ${table_prefix}options AS o2 " .
|
||||
"WHERE o1.option_name = o2.option_name " .
|
||||
"AND o1.option_id < o2.option_id)";
|
||||
}
|
||||
// Fix tables listing
|
||||
elseif( 0 === strpos($sql, 'SHOW TABLES'))
|
||||
@@ -321,6 +328,19 @@ WHERE bc.oid = i.indrelid
|
||||
$index = $table.'_'.$index;
|
||||
$sql = "CREATE {$unique}INDEX $index ON $table ($columns)";
|
||||
}
|
||||
$pattern = '/ALTER TABLE\s+(\w+)\s+DROP INDEX\s+([^\s]+)/';
|
||||
if( 1 === preg_match( $pattern, $sql, $matches))
|
||||
{
|
||||
$table = $matches[1];
|
||||
$index = $matches[2];
|
||||
$sql = "DROP INDEX ${table}_${index}";
|
||||
}
|
||||
$pattern = '/ALTER TABLE\s+(\w+)\s+DROP PRIMARY KEY/';
|
||||
if( 1 === preg_match( $pattern, $sql, $matches))
|
||||
{
|
||||
$table = $matches[1];
|
||||
$sql = "ALTER TABLE ${table} DROP CONSTRAINT ${table}_pkey";
|
||||
}
|
||||
}
|
||||
// Table description
|
||||
elseif( 0 === strpos( $sql, 'DESCRIBE'))
|
||||
|
@@ -50,7 +50,9 @@ There is no screenshot for this plugin
|
||||
|
||||
== Changelog ==
|
||||
|
||||
* Upgrading from WP 2.8.6 to WP 2.9.1 works with errors
|
||||
|
||||
* Upgrading from WP 2.8.6 to WP 2.9.1 works with a minor error
|
||||
Upgrading should remove an index on table "wp_options" that may not exist, throwing an error
|
||||
* Installing WP 2.9.1 works smoothly
|
||||
* Generic hack to avoid duplicate index names
|
||||
* REGEXP gets replaced with '~'
|
||||
|
Reference in New Issue
Block a user