SysTime.Migration (SysTime v0.1.0)

Copy Markdown View Source

PostgreSQL migration helpers. Install shared functions with up/0, then call install/2 after creating each base table. sync/1 accepts only trailing additions and raises on existing-position drift or removal.

Summary

Functions

Removes shared functions after all tables are uninstalled. Keeps btree_gist.

Adds system versioning. :prefix defaults to the migration prefix.

Appends trailing history columns and replaces views without dropping them.

Removes system versioning and its stored history.

Installs the shared schema, functions, and btree_gist.

Functions

down()

Removes shared functions after all tables are uninstalled. Keeps btree_gist.

install(table, opts \\ [])

Adds system versioning. :prefix defaults to the migration prefix.

sync(table)

Appends trailing history columns and replaces views without dropping them.

This operation is deliberately irreversible in change/0; call it from an explicit up/0 and write the corresponding removal DDL in down/0.

uninstall(table, opts \\ [])

Removes system versioning and its stored history.

up()

Installs the shared schema, functions, and btree_gist.