88use Yiisoft \Db \Connection \ConnectionInterface ;
99use Yiisoft \Db \Constant \ColumnType ;
1010use Yiisoft \Db \Constant \ReferentialAction ;
11- use Yiisoft \Db \Constraint \CheckConstraint ;
12- use Yiisoft \Db \Constraint \ForeignKeyConstraint ;
13- use Yiisoft \Db \Constraint \IndexConstraint ;
11+ use Yiisoft \Db \Constraint \Check ;
12+ use Yiisoft \Db \Constraint \ForeignKey ;
13+ use Yiisoft \Db \Constraint \Index ;
1414use Yiisoft \Db \Driver \Pdo \AbstractPdoSchema ;
1515use Yiisoft \Db \Exception \NotSupportedException ;
1616use Yiisoft \Db \Helper \DbArrayHelper ;
@@ -230,15 +230,15 @@ protected function loadTableSchema(string $name): TableSchemaInterface|null
230230 return null ;
231231 }
232232
233- protected function loadTablePrimaryKey (string $ tableName ): IndexConstraint |null
233+ protected function loadTablePrimaryKey (string $ tableName ): Index |null
234234 {
235- /** @var IndexConstraint |null */
235+ /** @var Index |null */
236236 return $ this ->loadTableConstraints ($ tableName , self ::PRIMARY_KEY );
237237 }
238238
239239 protected function loadTableForeignKeys (string $ tableName ): array
240240 {
241- /** @var ForeignKeyConstraint [] */
241+ /** @var ForeignKey [] */
242242 return $ this ->loadTableConstraints ($ tableName , self ::FOREIGN_KEYS );
243243 }
244244
@@ -280,7 +280,7 @@ protected function loadTableIndexes(string $tableName): array
280280 }
281281
282282 /** @var string[] $columnNames */
283- $ result [] = new IndexConstraint (
283+ $ result [] = new Index (
284284 $ name ,
285285 $ columnNames ,
286286 (bool ) $ index [0 ]['is_unique ' ],
@@ -293,13 +293,13 @@ protected function loadTableIndexes(string $tableName): array
293293
294294 protected function loadTableUniques (string $ tableName ): array
295295 {
296- /** @var IndexConstraint [] */
296+ /** @var Index [] */
297297 return $ this ->loadTableConstraints ($ tableName , self ::UNIQUES );
298298 }
299299
300300 protected function loadTableChecks (string $ tableName ): array
301301 {
302- /** @var CheckConstraint [] */
302+ /** @var Check [] */
303303 return $ this ->loadTableConstraints ($ tableName , self ::CHECKS );
304304 }
305305
@@ -598,9 +598,9 @@ public function findUniqueIndexes(TableSchemaInterface $table): array
598598 * - uniques
599599 * - checks
600600 *
601- * @return CheckConstraint []|ForeignKeyConstraint []|IndexConstraint|IndexConstraint []|null Constraints.
601+ * @return Check []|ForeignKey []|Index|Index []|null Constraints.
602602 */
603- private function loadTableConstraints (string $ tableName , string $ returnType ): array |IndexConstraint |null
603+ private function loadTableConstraints (string $ tableName , string $ returnType ): array |Index |null
604604 {
605605 $ sql = <<<SQL
606606 SELECT
@@ -647,32 +647,33 @@ private function loadTableConstraints(string $tableName, string $returnType): ar
647647 foreach ($ names as $ name => $ constraint ) {
648648 switch ($ type ) {
649649 case 'P ' :
650- $ result [self ::PRIMARY_KEY ] = new IndexConstraint (
650+ $ result [self ::PRIMARY_KEY ] = new Index (
651651 $ name ,
652652 array_column ($ constraint , 'column_name ' ),
653653 true ,
654654 true ,
655655 );
656656 break ;
657657 case 'R ' :
658- $ result [self ::FOREIGN_KEYS ][] = new ForeignKeyConstraint (
658+ $ result [self ::FOREIGN_KEYS ][] = new ForeignKey (
659659 $ name ,
660660 array_column ($ constraint , 'column_name ' ),
661- $ constraint [0 ]['foreign_table_schema ' ] . '. ' . $ constraint [0 ]['foreign_table_name ' ],
661+ $ constraint [0 ]['foreign_table_schema ' ],
662+ $ constraint [0 ]['foreign_table_name ' ],
662663 array_column ($ constraint , 'foreign_column_name ' ),
663- null ,
664664 $ constraint [0 ]['on_delete ' ],
665+ null ,
665666 );
666667 break ;
667668 case 'U ' :
668- $ result [self ::UNIQUES ][] = new IndexConstraint (
669+ $ result [self ::UNIQUES ][] = new Index (
669670 $ name ,
670671 array_column ($ constraint , 'column_name ' ),
671672 true ,
672673 );
673674 break ;
674675 case 'C ' :
675- $ result [self ::CHECKS ][] = new CheckConstraint (
676+ $ result [self ::CHECKS ][] = new Check (
676677 $ name ,
677678 array_column ($ constraint , 'column_name ' ),
678679 $ constraint [0 ]['check_expr ' ],
0 commit comments