db\sqlite\QueryBuilder addForeignKey()

addForeignKey() public method

Builds a SQL statement for adding a foreign key constraint to an existing table.

The method will properly quote the table and column names.

public string addForeignKey ( $name, $table, $columns, $refTable, $refColumns, $delete = null, $update = null )
$name string

The name of the foreign key constraint.

$table string

The table that the foreign key constraint will be added to.

$columns string|array

The name of the column to that the constraint will be added on. If there are multiple columns, separate them with commas or use an array to represent them.

$refTable string

The table that the foreign key references to.

$refColumns string|array

The name of the column that the foreign key references to. If there are multiple columns, separate them with commas or use an array to represent them.

$delete string

The ON DELETE option. Most DBMS support these options: RESTRICT, CASCADE, NO ACTION, SET DEFAULT, SET NULL

$update string

The ON UPDATE option. Most DBMS support these options: RESTRICT, CASCADE, NO ACTION, SET DEFAULT, SET NULL

return string

The SQL statement for adding a foreign key constraint to an existing table.

throws yii\base\NotSupportedException

this is not supported by SQLite

doc_Yii
2016-10-30 16:59:52
Comments
Leave a Comment

Please login to continue.