|
@@ 458-464 (lines=7) @@
|
| 455 |
|
* @param array $options Options |
| 456 |
|
* @return \Phinx\Db\Table |
| 457 |
|
*/ |
| 458 |
|
public function addForeignKey($columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 459 |
|
{ |
| 460 |
|
$action = AddForeignKey::build($this->table, $columns, $referencedTable, $referencedColumns, $options); |
| 461 |
|
$this->actions->addAction($action); |
| 462 |
|
|
| 463 |
|
return $this; |
| 464 |
|
} |
| 465 |
|
|
| 466 |
|
/** |
| 467 |
|
* Add a foreign key to a database table with a given name. |
|
@@ 479-492 (lines=14) @@
|
| 476 |
|
* @param array $options Options |
| 477 |
|
* @return \Phinx\Db\Table |
| 478 |
|
*/ |
| 479 |
|
public function addForeignKeyWithName($name, $columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 480 |
|
{ |
| 481 |
|
$action = AddForeignKey::build( |
| 482 |
|
$this->table, |
| 483 |
|
$columns, |
| 484 |
|
$referencedTable, |
| 485 |
|
$referencedColumns, |
| 486 |
|
$options, |
| 487 |
|
$name |
| 488 |
|
); |
| 489 |
|
$this->actions->addAction($action); |
| 490 |
|
|
| 491 |
|
return $this; |
| 492 |
|
} |
| 493 |
|
|
| 494 |
|
/** |
| 495 |
|
* Removes the given foreign key from the table. |