|
@@ 426-432 (lines=7) @@
|
| 423 |
|
* @param array $options Options |
| 424 |
|
* @return \Phinx\Db\Table |
| 425 |
|
*/ |
| 426 |
|
public function addForeignKey($columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 427 |
|
{ |
| 428 |
|
$action = AddForeignKey::build($this->table, $columns, $referencedTable, $referencedColumns, $options); |
| 429 |
|
$this->actions->addAction($action); |
| 430 |
|
|
| 431 |
|
return $this; |
| 432 |
|
} |
| 433 |
|
|
| 434 |
|
/** |
| 435 |
|
* Add a foreign key to a database table with a given name. |
|
@@ 447-460 (lines=14) @@
|
| 444 |
|
* @param array $options Options |
| 445 |
|
* @return \Phinx\Db\Table |
| 446 |
|
*/ |
| 447 |
|
public function addForeignKeyWithName($name, $columns, $referencedTable, $referencedColumns = ['id'], $options = []) |
| 448 |
|
{ |
| 449 |
|
$action = AddForeignKey::build( |
| 450 |
|
$this->table, |
| 451 |
|
$columns, |
| 452 |
|
$referencedTable, |
| 453 |
|
$referencedColumns, |
| 454 |
|
$options, |
| 455 |
|
$name |
| 456 |
|
); |
| 457 |
|
$this->actions->addAction($action); |
| 458 |
|
|
| 459 |
|
return $this; |
| 460 |
|
} |
| 461 |
|
|
| 462 |
|
/** |
| 463 |
|
* Removes the given foreign key from the table. |