|
@@ 414-420 (lines=7) @@
|
| 411 |
|
* @param array $options Options |
| 412 |
|
* @return \Phinx\Db\Table |
| 413 |
|
*/ |
| 414 |
|
public function addForeignKey($columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 415 |
|
{ |
| 416 |
|
$action = AddForeignKey::build($this->table, $columns, $referencedTable, $referencedColumns, $options); |
| 417 |
|
$this->actions->addAction($action); |
| 418 |
|
|
| 419 |
|
return $this; |
| 420 |
|
} |
| 421 |
|
|
| 422 |
|
/** |
| 423 |
|
* Add a foreign key to a database table with a given name. |
|
@@ 435-448 (lines=14) @@
|
| 432 |
|
* @param array $options Options |
| 433 |
|
* @return \Phinx\Db\Table |
| 434 |
|
*/ |
| 435 |
|
public function addForeignKeyWithName($name, $columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 436 |
|
{ |
| 437 |
|
$action = AddForeignKey::build( |
| 438 |
|
$this->table, |
| 439 |
|
$columns, |
| 440 |
|
$referencedTable, |
| 441 |
|
$referencedColumns, |
| 442 |
|
$options, |
| 443 |
|
$name |
| 444 |
|
); |
| 445 |
|
$this->actions->addAction($action); |
| 446 |
|
|
| 447 |
|
return $this; |
| 448 |
|
} |
| 449 |
|
|
| 450 |
|
/** |
| 451 |
|
* Removes the given foreign key from the table. |