@@ -243,7 +243,9 @@ protected function _getCreateTableSQL(OptionallyQualifiedName $tableName, array
243243 $ sql [] = 'TEMPORARY ' ;
244244 }
245245
246- $ sql [] = 'TABLE ' . $ tableName ->toSQL ($ this ) . ' ( ' . implode (', ' , $ elements ) . ') ' ;
246+ $ tableNameSQL = $ tableName ->toSQL ($ this );
247+
248+ $ sql [] = sprintf ('TABLE %s (%s) ' , $ tableNameSQL , implode (', ' , $ elements ));
247249
248250 $ tableOptions = $ this ->buildTableOptions ($ parameters );
249251
@@ -259,19 +261,19 @@ protected function _getCreateTableSQL(OptionallyQualifiedName $tableName, array
259261
260262 if (isset ($ parameters ['foreignKeys ' ])) {
261263 foreach ($ parameters ['foreignKeys ' ] as $ definition ) {
262- $ sql [] = $ this ->getCreateForeignKeySQL ($ definition , $ tableName -> toSQL ( $ this ) );
264+ $ sql [] = $ this ->getCreateForeignKeySQL ($ definition , $ tableNameSQL );
263265 }
264266 }
265267
266268 return $ sql ;
267269 }
268270
269- public function getCreateIndexSQL (Index $ index , string $ table ): string
271+ public function getCreateIndexSQL (Index $ index , string $ tableName ): string
270272 {
271273 $ this ->ensureIndexIsNotClustered ($ index );
272274 $ this ->ensureIndexIsNotPartial ($ index );
273275
274- return parent ::getCreateIndexSQL ($ index , $ table );
276+ return parent ::getCreateIndexSQL ($ index , $ tableName );
275277 }
276278
277279 /**
@@ -557,19 +559,22 @@ protected function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreign
557559 return $ query ;
558560 }
559561
560- public function getDropIndexSQL (string $ name , string $ table ): string
562+ public function getDropIndexSQL (string $ indexName , string $ tableName ): string
561563 {
562- return 'DROP INDEX ' . $ name . ' ON ' . $ table ;
564+ $ parsedIndexName = $ this ->parseUnqualifiedName ($ indexName );
565+ $ parsedTableName = $ this ->parseOptionallyQualifiedName ($ tableName );
566+
567+ return sprintf ('DROP INDEX %s ON %s ' , $ parsedIndexName ->toSQL ($ this ), $ parsedTableName ->toSQL ($ this ));
563568 }
564569
565570 /**
566571 * The `ALTER TABLE ... DROP CONSTRAINT` syntax is only available as of MySQL 8.0.19.
567572 *
568573 * @link https://dev.mysql.com/doc/refman/8.0/en/alter-table.html
569574 */
570- public function getDropUniqueConstraintSQL (string $ name , string $ tableName ): string
575+ public function getDropUniqueConstraintSQL (string $ constraintName , string $ tableName ): string
571576 {
572- return $ this ->getDropIndexSQL ($ name , $ tableName );
577+ return $ this ->getDropIndexSQL ($ constraintName , $ tableName );
573578 }
574579
575580 public function getSetTransactionIsolationSQL (TransactionIsolationLevel $ level ): string
@@ -621,9 +626,11 @@ protected function initializeDoctrineTypeMappings(): void
621626 * MySQL commits a transaction implicitly when DROP TABLE is executed, however not
622627 * if DROP TEMPORARY TABLE is executed.
623628 */
624- public function getDropTemporaryTableSQL (string $ table ): string
629+ public function getDropTemporaryTableSQL (string $ tableName ): string
625630 {
626- return 'DROP TEMPORARY TABLE ' . $ table ;
631+ $ parsedName = $ this ->parseOptionallyQualifiedName ($ tableName );
632+
633+ return sprintf ('DROP TEMPORARY TABLE %s ' , $ parsedName ->toSQL ($ this ));
627634 }
628635
629636 /**
0 commit comments