Rel.Table
Table descriptions.
Tables simply give a name to rows.
The type for exensible table parameters. See Parameters.
The type for tables with rows represented by type 'r
. Unless you get into recursive trouble, use the constructor v
.
v name ~params r
is a table with corresponding attributes.
val name : 'r t -> string
name t
is the name of t
.
cols t
is Row.cols
(row t)
with columns in ignore
ommited from the result.
The type for foreign key actions.
type ('r, 's) foreign_key = {
cols : 'r Col.v list; |
reference : 's t * 's Col.v list; |
on_delete : foreign_key_action option; |
on_update : foreign_key_action option; |
}
The type for representing foreign keys from table 'r
to 's
. This is exposed for recursive defs reasons, use foreign_key
unless you get into trouble. FIXME. At least provide a default empty value so that with
can be used.
val foreign_key :
?on_delete:foreign_key_action ->
?on_update:foreign_key_action ->
cols:'r Col.v list ->
reference:('s t * 's Col.v list) ->
unit ->
( 'r, 's ) foreign_key
foreign_key
is a foreign key with given paramers
val foreign_key_cols : ( 'r, 's ) foreign_key -> 'r Col.v list
val foreign_key_reference : ( 'r, 's ) foreign_key -> 's t * 's Col.v list
type param +=
| Primary_key : 'r Col.v list -> 'r param |
| Unique : 'r Col.v list -> 'r param |
| Foreign_key : ( 'r, 's ) foreign_key -> 'r param |
| Index : 'r Index.t -> 'r param |
Common table parameters.
Primary_key cols
, declares a table primary key constraint on columns cols
.Unique cols
, declares a uniqueness constraint on cols
Foreign_key (cols, (t, cols'))
declares a foreign key between cols
and the columns cols' of t
. Can be repeated.Index
is an index specification for the table.indexes t
are the indexes of table t
found in the table's parameters.