|
@@ 432-438 (lines=7) @@
|
| 429 |
|
* @param array $options Options |
| 430 |
|
* @return \Phinx\Db\Table |
| 431 |
|
*/ |
| 432 |
|
public function addForeignKey($columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 433 |
|
{ |
| 434 |
|
$action = AddForeignKey::build($this->table, $columns, $referencedTable, $referencedColumns, $options); |
| 435 |
|
$this->actions->addAction($action); |
| 436 |
|
|
| 437 |
|
return $this; |
| 438 |
|
} |
| 439 |
|
|
| 440 |
|
/** |
| 441 |
|
* Add a foreign key to a database table with a given name. |
|
@@ 453-466 (lines=14) @@
|
| 450 |
|
* @param array $options Options |
| 451 |
|
* @return \Phinx\Db\Table |
| 452 |
|
*/ |
| 453 |
|
public function addForeignKeyWithName($name, $columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 454 |
|
{ |
| 455 |
|
$action = AddForeignKey::build( |
| 456 |
|
$this->table, |
| 457 |
|
$columns, |
| 458 |
|
$referencedTable, |
| 459 |
|
$referencedColumns, |
| 460 |
|
$options, |
| 461 |
|
$name |
| 462 |
|
); |
| 463 |
|
$this->actions->addAction($action); |
| 464 |
|
|
| 465 |
|
return $this; |
| 466 |
|
} |
| 467 |
|
|
| 468 |
|
/** |
| 469 |
|
* Removes the given foreign key from the table. |