Skip to content

Install

You need opam, OCaml’s package manager, and OCaml 5.5 or later.

Terminal window
brew install opam
Terminal window
opam init
eval $(opam env)

Answer yes when opam init offers to set up your shell. It installs the latest OCaml, which takes a few minutes. If you had opam already, check ocaml -version; older than 5.5, make a switch with the latest OCaml:

Terminal window
opam switch create rowtype ocaml-base-compiler
eval $(opam env)
Terminal window
opam repo add hypha https://github.com/hyphatech/opam-repository.git
opam install rowtype rowtype-postgres rowtype-migrate # Postgres
opam install rowtype rowtype-sqlite rowtype-migrate # SQLite, through its C library
Package What it is
rowtype queries described once; links no database library
rowtype-postgres the Postgres backend, over postgres-eio
rowtype-sqlite the SQLite backend, over the sqlite3 binding
rowtype-migrate the migrations and the rowtype-migrate command, for each dialect installed beside it

rowtype-migrate migrates the dialects whose backend is installed beside it, and links no other: its libraries are rowtype-migrate.postgres and rowtype-migrate.sqlite, each built where its backend is.

rowtype-sqlite links your system’s SQLite. Where it is missing, opam offers to install it with your system’s package manager.

A program names the libraries it uses in its dune file. On Postgres:

(libraries rowtype rowtype-postgres eio_main)

On SQLite:

(libraries rowtype rowtype-sqlite eio_main)

The quick start writes a whole program, next.