Table.Foreign_keyForeign keys definitions.
Foreign keys represent SQL FOREIGN KEY constraints on a table.
We use the parent-child terminology of SQLite. The parent table is the table that the foreign key refers to. The child table is the table making the reference.
type action = [ | `Set_nullThe child key becomes NULL.
*)| `Set_defaultThe child key is set to the default.
*)| `CascadeThe row with the child key gets deleted or updated.
*)| `RestrictThe parent key cannot be deleted or updated.
*) ]The type for foreign key actions on parent delete or updates.
This is the parent table and the columns that are referenced within. Use Self to refer to table being defined.
Note. For now the module does not check that the list of columns actually belong the parent table. Do not rely on this Invalid_argument may be raised in the future on make.
val make :
?on_delete:action ->
?on_update:action ->
cols:'r Col.def list ->
parent:parent ->
unit ->
'r tv ?on_delete ?on_update ~cols ~parent () is a foreign key with given arguments. See accessors for semantics.
on_delete fk is the action taken whenever the parent key of fk is deleted.