|
@@ 442-448 (lines=7) @@
|
| 439 |
|
* @param array $options Options |
| 440 |
|
* @return \Phinx\Db\Table |
| 441 |
|
*/ |
| 442 |
|
public function addForeignKey($columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 443 |
|
{ |
| 444 |
|
$action = AddForeignKey::build($this->table, $columns, $referencedTable, $referencedColumns, $options); |
| 445 |
|
$this->actions->addAction($action); |
| 446 |
|
|
| 447 |
|
return $this; |
| 448 |
|
} |
| 449 |
|
|
| 450 |
|
/** |
| 451 |
|
* Add a foreign key to a database table with a given name. |
|
@@ 463-476 (lines=14) @@
|
| 460 |
|
* @param array $options Options |
| 461 |
|
* @return \Phinx\Db\Table |
| 462 |
|
*/ |
| 463 |
|
public function addForeignKeyWithName($name, $columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 464 |
|
{ |
| 465 |
|
$action = AddForeignKey::build( |
| 466 |
|
$this->table, |
| 467 |
|
$columns, |
| 468 |
|
$referencedTable, |
| 469 |
|
$referencedColumns, |
| 470 |
|
$options, |
| 471 |
|
$name |
| 472 |
|
); |
| 473 |
|
$this->actions->addAction($action); |
| 474 |
|
|
| 475 |
|
return $this; |
| 476 |
|
} |
| 477 |
|
|
| 478 |
|
/** |
| 479 |
|
* Removes the given foreign key from the table. |