mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
BUGFIX Make use of fulltextIndexExists() in MSSQLDatabase::getIndexSqlDefinition() instead of issuing it's own query to do so
This commit is contained in:
parent
3bba7b9ef1
commit
6bfa6e9d0f
@ -682,14 +682,14 @@ class MSSQLDatabase extends SS_Database {
|
||||
if($this->fullTextEnabled) {
|
||||
//Enable full text search.
|
||||
$this->createFullTextCatalog();
|
||||
|
||||
|
||||
$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;";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user