99namespace Migrations \Db \Action ;
1010
1111use Migrations \Db \Table \ForeignKey ;
12- use Migrations \Db \Table \Table ;
12+ use Migrations \Db \Table \TableMetadata ;
1313
1414class AddForeignKey extends Action
1515{
@@ -23,10 +23,10 @@ class AddForeignKey extends Action
2323 /**
2424 * Constructor
2525 *
26- * @param \Migrations\Db\Table\Table $table The table to add the foreign key to
26+ * @param \Migrations\Db\Table\TableMetadata $table The table to add the foreign key to
2727 * @param \Migrations\Db\Table\ForeignKey $fk The foreign key to add
2828 */
29- public function __construct (Table $ table , ForeignKey $ fk )
29+ public function __construct (TableMetadata $ table , ForeignKey $ fk )
3030 {
3131 parent ::__construct ($ table );
3232 $ this ->foreignKey = $ fk ;
@@ -36,22 +36,28 @@ public function __construct(Table $table, ForeignKey $fk)
3636 * Creates a new AddForeignKey object after building the foreign key with
3737 * the passed attributes
3838 *
39- * @param \Migrations\Db\Table\Table $table The table object to add the foreign key to
39+ * @param \Migrations\Db\Table\TableMetadata $table The table object to add the foreign key to
4040 * @param string|string[] $columns The columns for the foreign key
41- * @param \Migrations\Db\Table\Table |string $referencedTable The table the foreign key references
41+ * @param \Migrations\Db\Table\TableMetadata |string $referencedTable The table the foreign key references
4242 * @param string|string[] $referencedColumns The columns in the referenced table
4343 * @param array<string, mixed> $options Extra options for the foreign key
4444 * @param string|null $name The name of the foreign key
4545 * @return self
4646 */
47- public static function build (Table $ table , string |array $ columns , Table |string $ referencedTable , string |array $ referencedColumns = ['id ' ], array $ options = [], ?string $ name = null ): self
48- {
47+ public static function build (
48+ TableMetadata $ table ,
49+ string |array $ columns ,
50+ TableMetadata |string $ referencedTable ,
51+ string |array $ referencedColumns = ['id ' ],
52+ array $ options = [],
53+ ?string $ name = null ,
54+ ): self {
4955 if (is_string ($ referencedColumns )) {
5056 $ referencedColumns = [$ referencedColumns ]; // str to array
5157 }
5258
5359 if (is_string ($ referencedTable )) {
54- $ referencedTable = new Table ($ referencedTable );
60+ $ referencedTable = new TableMetadata ($ referencedTable );
5561 }
5662
5763 // Shimming old 4.x
0 commit comments