File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 2323use Doctrine \Deprecations \Deprecation ;
2424use LogicException ;
2525
26+ use function array_diff_key ;
2627use function array_map ;
2728use function array_merge ;
2829use function array_values ;
@@ -1002,7 +1003,7 @@ public function edit(): TableEditor
10021003 $ editor = self ::editor ()
10031004 ->setName ($ this ->getObjectName ())
10041005 ->setColumns (...array_values ($ this ->_columns ))
1005- ->setIndexes (...array_values ($ this ->_indexes ))
1006+ ->setIndexes (...array_values (array_diff_key ( $ this ->_indexes , $ this -> implicitIndexNames ) ))
10061007 ->setPrimaryKeyConstraint ($ this ->primaryKeyConstraint )
10071008 ->setUniqueConstraints (...array_values ($ this ->uniqueConstraints ))
10081009 ->setForeignKeyConstraints (...array_values ($ this ->_fkConstraints ));
Original file line number Diff line number Diff line change 1313use Doctrine \DBAL \Schema \Exception \PrimaryKeyAlreadyExists ;
1414use Doctrine \DBAL \Schema \ForeignKeyConstraint ;
1515use Doctrine \DBAL \Schema \Index ;
16+ use Doctrine \DBAL \Schema \Index \IndexType ;
1617use Doctrine \DBAL \Schema \Name \Identifier ;
1718use Doctrine \DBAL \Schema \PrimaryKeyConstraint ;
1819use Doctrine \DBAL \Schema \SchemaException ;
@@ -716,7 +717,15 @@ public function testAddingFulfillingUniqueIndexOverridesImplicitForeignKeyConstr
716717
717718 self ::assertCount (1 , $ localTable ->getIndexes ());
718719
719- $ localTable ->addUniqueIndex (['id ' ], 'explicit_idx ' );
720+ $ localTable = $ localTable ->edit ()
721+ ->addIndex (
722+ Index::editor ()
723+ ->setUnquotedName ('explicit_idx ' )
724+ ->setType (IndexType::UNIQUE )
725+ ->setUnquotedColumnNames ('id ' )
726+ ->create (),
727+ )
728+ ->create ();
720729
721730 self ::assertCount (1 , $ localTable ->getIndexes ());
722731 self ::assertTrue ($ localTable ->hasIndex ('explicit_idx ' ));
You can’t perform that action at this time.
0 commit comments