StatifierPersistence.Ecto.Migrations.V01 (StatifierPersistence v0.3.0)

Copy Markdown View Source

V01 of the package DDL: the charts, positions, and runs tables per ADR-0002 (as amended) and the storage contract's field set (ADR-0003 decision 3).

Table names, the surrogate primary key's column type, and the Postgres schema all come from the resolved StatifierPersistence.Ecto.Config - the same struct the generated schemas are built from. The engine identity columns (content_hash, session_id, run_id) are text with their unique indexes regardless of the configured key scheme: the identity guard never touches a surrogate key.

This migration always emits :binary (bytea) for the three blob columns (identity_blob, chart_blob, position_blob) and does not read Config's :blob_type option. A custom :blob_type whose underlying database type is still binary (an envelope-encrypting type that dumps to and loads from raw bytes, for example) needs no DDL change - this migration already matches it. A :blob_type that dumps to a different underlying type (text, jsonb, a Postgres domain) needs the host to alter those three columns itself; this helper does not do it for them.

Summary

Functions

Drops the V01 tables in reverse creation order.

Creates the V01 tables and their unique indexes per config.

Functions

down(config)

@spec down(StatifierPersistence.Ecto.Config.t()) :: :ok

Drops the V01 tables in reverse creation order.

up(config)

Creates the V01 tables and their unique indexes per config.