BUGFIX Check index exists when issuing the DROP INDEX query in PostgreSQLDatabase::alterTable()

This commit is contained in:
Sean Harvey 2010-09-17 00:44:11 +00:00
parent c6e0714c62
commit 3b3258d3ae

View File

@ -393,9 +393,9 @@ class PostgreSQLDatabase extends SS_Database {
if(isset($indexes[$v['value']])){
if(is_array($v))
$alterIndexList[] = 'DROP INDEX ix_' . strtolower($tableName) . '_' . strtolower($v['value']) . ';';
$alterIndexList[] = 'DROP INDEX IF EXISTS ix_' . strtolower($tableName) . '_' . strtolower($v['value']) . ';';
else
$alterIndexList[] = 'DROP INDEX ix_' . strtolower($tableName) . '_' . strtolower(trim($v, '()')) . ';';
$alterIndexList[] = 'DROP INDEX IF EXISTS ix_' . strtolower($tableName) . '_' . strtolower(trim($v, '()')) . ';';
$k=$v['value'];
$createIndex=$this->getIndexSqlDefinition($tableName, $k, $v);
@ -415,9 +415,9 @@ class PostgreSQLDatabase extends SS_Database {
}
if(isset($indexes[$name])){
if(is_array($v)){
$alterIndexList[] = 'DROP INDEX ix_' . strtolower($tableName) . '_' . strtolower($v['value']) . ';';
$alterIndexList[] = 'DROP INDEX IF EXISTS ix_' . strtolower($tableName) . '_' . strtolower($v['value']) . ';';
} else {
$alterIndexList[] = 'DROP INDEX ' . $indexes[$name]['indexname'] . ';';
$alterIndexList[] = 'DROP INDEX IF EXISTS ' . $indexes[$name]['indexname'] . ';';
}
}