mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fix FulltextsearchEnable
This commit is contained in:
parent
f35786de0a
commit
6a2245474d
@ -310,17 +310,16 @@ abstract class DBSchemaManager {
|
|||||||
|
|
||||||
// Check if options changed
|
// Check if options changed
|
||||||
$tableOptionsChanged = false;
|
$tableOptionsChanged = false;
|
||||||
if (isset($options[get_class($this)]) || true) {
|
// Check for DB constant on the schema class
|
||||||
if (isset($options[get_class($this)])) {
|
$dbIDName = sprintf('%s::ID', get_class($this));
|
||||||
if (preg_match('/ENGINE=([^\s]*)/', $options[get_class($this)], $alteredEngineMatches)) {
|
$dbID = defined($dbIDName) ? constant($dbIDName) : null;
|
||||||
|
if ($dbID && isset($options[$dbID])) {
|
||||||
|
if (preg_match('/ENGINE=([^\s]*)/', $options[$dbID], $alteredEngineMatches)) {
|
||||||
$alteredEngine = $alteredEngineMatches[1];
|
$alteredEngine = $alteredEngineMatches[1];
|
||||||
$tableStatus = $this->query(sprintf(
|
$tableStatus = $this->query(sprintf('SHOW TABLE STATUS LIKE \'%s\'', $table))->first();
|
||||||
'SHOW TABLE STATUS LIKE \'%s\'', $table
|
|
||||||
))->first();
|
|
||||||
$tableOptionsChanged = ($tableStatus['Engine'] != $alteredEngine);
|
$tableOptionsChanged = ($tableStatus['Engine'] != $alteredEngine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($tableOptionsChanged || ($extensions && $this->database->supportsExtensions($extensions))) {
|
if ($tableOptionsChanged || ($extensions && $this->database->supportsExtensions($extensions))) {
|
||||||
$this->transAlterTable($table, $options, $extensions);
|
$this->transAlterTable($table, $options, $extensions);
|
||||||
|
@ -84,7 +84,8 @@ class MySQLSchemaManager extends DBSchemaManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($alteredOptions && isset($alteredOptions[get_class($this)])) {
|
$dbID = self::ID;
|
||||||
|
if ($alteredOptions && isset($alteredOptions[$dbID])) {
|
||||||
$indexList = $this->indexList($tableName);
|
$indexList = $this->indexList($tableName);
|
||||||
$skip = false;
|
$skip = false;
|
||||||
foreach ($indexList as $index) {
|
foreach ($indexList as $index) {
|
||||||
@ -98,14 +99,14 @@ class MySQLSchemaManager extends DBSchemaManager {
|
|||||||
sprintf(
|
sprintf(
|
||||||
"Table %s options not changed to %s due to fulltextsearch index",
|
"Table %s options not changed to %s due to fulltextsearch index",
|
||||||
$tableName,
|
$tableName,
|
||||||
$alteredOptions[get_class($this)]
|
$alteredOptions[$dbID]
|
||||||
),
|
),
|
||||||
"changed"
|
"changed"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->query(sprintf("ALTER TABLE \"%s\" %s", $tableName, $alteredOptions[get_class($this)]));
|
$this->query(sprintf("ALTER TABLE \"%s\" %s", $tableName, $alteredOptions[$dbID]));
|
||||||
$this->alterationMessage(
|
$this->alterationMessage(
|
||||||
sprintf("Table %s options changed: %s", $tableName, $alteredOptions[get_class($this)]),
|
sprintf("Table %s options changed: %s", $tableName, $alteredOptions[$dbID]),
|
||||||
"changed"
|
"changed"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user