Skip to content

Commit 9059582

Browse files
committed
Add logging for fulltext index errors
1 parent 0343a0a commit 9059582

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

modules/datastore/src/DataDictionary/AlterTableQuery/MySQLQuery.php

+10-4
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public function setCsvHeaderMode($mode) {
105105
$this->csvHeadersMode = $mode ?? 'resource_headers';
106106
}
107107

108+
108109
/**
109110
* {@inheritdoc}
110111
*/
@@ -538,10 +539,15 @@ protected function buildAddIndexOptions(array $indexes, string $table, array $ty
538539
* Description of the index.
539540
*/
540541
protected function executeFulltextAlter(string $table, string $name, string $formatted_field_options, string $comment): void {
541-
// Innodb only allows adding one fulltext index at a time.
542-
$command = $this->connection->prepareStatement("ALTER TABLE {{$table}} ADD FULLTEXT INDEX {$name} ({$formatted_field_options}) COMMENT '{$comment}';", []);
543-
// Execute alter command.
544-
$command->execute();
542+
try {
543+
// Innodb only allows adding one fulltext index at a time.
544+
$command = $this->connection->prepareStatement("ALTER TABLE {{$table}} ADD FULLTEXT INDEX {$name} ({$formatted_field_options}) COMMENT '{$comment}';", []);
545+
// Execute alter command.
546+
$command->execute();
547+
}
548+
catch (\Exception) {
549+
\Drupal::logger('Data Dictionary')->error("Error applying fulltext index to dataset {$comment}");
550+
}
545551
}
546552

547553
/**

0 commit comments

Comments
 (0)