BUGFIX Make use of fulltextIndexExists() in MSSQLDatabase::getIndexSqlDefinition() instead of issuing it's own query to do so

This commit is contained in:
Sean Harvey 2009-12-08 20:53:15 +00:00
parent 3bba7b9ef1
commit 6bfa6e9d0f

View File

@ -685,11 +685,11 @@ class MSSQLDatabase extends SS_Database {
$primary_key=$this->getPrimaryKey($tableName);
//First, we need to see if a full text search already exists:
$result=$this->query("SELECT object_id FROM sys.fulltext_indexes WHERE object_id=object_id('$tableName');")->first();
$drop = '';
if($result) $drop = "DROP FULLTEXT INDEX ON \"" . $tableName . "\";";
if($this->fulltextIndexExists($tableName)) {
$drop = "DROP FULLTEXT INDEX ON \"$tableName\";";
}
return $drop . "CREATE FULLTEXT INDEX ON \"$tableName\" ({$indexSpec['value']}) KEY INDEX $primary_key WITH CHANGE_TRACKING AUTO;";
}
}