package petrol

  1. Overview
  2. Docs

Provides a helper interface, primarily for prototyping/debugging, that declares a static table without any versioning.

type t

A global schema, primarily intended for testing.

See also VersionedSchema.t, which is the recommended alternative, especially if you expect the schema to change in the future.

Note A schema t here represents a collection of table schemas but doesn't have to be an exhaustive enumeration - i.e it is possible to have multiple t valid for a given SQL database provided they refer to disjoint collections of tables.

val init : unit -> t

init version ~name constructs a new schema.

val declare_table : t -> ?constraints:[ `Table ] Schema.constraint_ list -> name:string -> 'a Schema.table -> table_name * 'a Expr.expr_list

declare_table t ?constraints ~name table_spec declares a new table on the schema t with the name name.

constraints are a list of SQL constraints on the columns of the table.

val initialise : t -> (module Caqti_lwt.CONNECTION) -> (unit, [> Caqti_error.t ]) Lwt_result.t

initialise t conn initialises the SQL schema on conn.

OCaml

Innovation. Community. Security.