Skip to content

Commit 4da4675

Browse files
committed
Run fulltext index alters separately from standard index alters
1 parent 485fccd commit 4da4675

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,15 @@ protected function buildAddIndexOptions(array $indexes, string $table, array $ty
514514
$comment = addslashes($description);
515515

516516
// Build add index option list.
517-
$add_index_options[] = "ADD {$mysql_index_type} INDEX {$name} ({$formatted_field_options}) COMMENT '{$comment}'";
517+
if ($index_type == 'index') {
518+
$add_index_options[] = "ADD {$mysql_index_type} INDEX {$name} ({$formatted_field_options}) COMMENT '{$comment}'";
519+
}
520+
if ($index_type == 'fulltext') {
521+
// Innodb only allows adding one fulltext index at a time.
522+
$command = $this->connection->prepareStatement("ALTER TABLE {$table} ADD {$mysql_index_type} INDEX {$name} ({$formatted_field_options}) COMMENT '{$comment}';", []);
523+
// Execute alter command.
524+
$command->execute();
525+
}
518526
}
519527

520528
return $add_index_options;

0 commit comments

Comments
 (0)