|
@@ 470-476 (lines=7) @@
|
| 467 |
|
* @param array $options Options |
| 468 |
|
* @return \Phinx\Db\Table |
| 469 |
|
*/ |
| 470 |
|
public function addForeignKey($columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 471 |
|
{ |
| 472 |
|
$action = AddForeignKey::build($this->table, $columns, $referencedTable, $referencedColumns, $options); |
| 473 |
|
$this->actions->addAction($action); |
| 474 |
|
|
| 475 |
|
return $this; |
| 476 |
|
} |
| 477 |
|
|
| 478 |
|
/** |
| 479 |
|
* Add a foreign key to a database table with a given name. |
|
@@ 491-504 (lines=14) @@
|
| 488 |
|
* @param array $options Options |
| 489 |
|
* @return \Phinx\Db\Table |
| 490 |
|
*/ |
| 491 |
|
public function addForeignKeyWithName($name, $columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 492 |
|
{ |
| 493 |
|
$action = AddForeignKey::build( |
| 494 |
|
$this->table, |
| 495 |
|
$columns, |
| 496 |
|
$referencedTable, |
| 497 |
|
$referencedColumns, |
| 498 |
|
$options, |
| 499 |
|
$name |
| 500 |
|
); |
| 501 |
|
$this->actions->addAction($action); |
| 502 |
|
|
| 503 |
|
return $this; |
| 504 |
|
} |
| 505 |
|
|
| 506 |
|
/** |
| 507 |
|
* Removes the given foreign key from the table. |