Barograph.Schema (barograph v0.1.0)

Copy Markdown View Source

DDL and metadata for a Barograph database file.

A Barograph file is self-describing: bg_meta records the schema version, time unit, and the library version that created the file. Opening a file written by an incompatible version is a checked operation, not a hope.

Summary

Functions

Initialises a fresh database or validates an existing one.

The schema version this library writes.

Valid time units for a database, fixed at creation.

Functions

migrate(conn, opts)

@spec migrate(
  Exqlite.Sqlite3.db(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Initialises a fresh database or validates an existing one.

Runs against a raw Exqlite.Sqlite3 connection. Returns the database metadata as a map on success.

Options:

  • :time_unit - required for creation; ignored (but validated, if given) when opening an existing database.

schema_version()

The schema version this library writes.

time_units()

Valid time units for a database, fixed at creation.