StatifierPersistence.Ecto.Migrations.V05 (StatifierPersistence v0.12.0)

Copy Markdown View Source

V05 of the package DDL: the per-execution input log table (ADR-0010 decision 9).

Four columns beside the surrogate key: execution_id, the execution the entry belongs to; seq, its dense zero-based ordinal; door, the public door it entered by (StatifierPersistence.Executions.entry/0, as a string); and input_blob, the opaque payload the facade encoded above the adapter. input_blob is nullable, and a null is not "no value": it is decision 6's closed marker, written in the cap's last slot when a host-declared cap is reached.

The unique index on (execution_id, seq) is what makes denseness true. StatifierPersistence.Storage.Ecto.append_input/3 takes its ordinal from the execution's current maximum, under the exclusion the append already runs inside; a lost race then fails the write instead of duplicating an ordinal, because a gap in a log is a defect and a duplicate is a silently reordered replay. It doubles as the lookup index: every read of this table is one execution's whole log in ascending seq, which the index serves directly.

No foreign key to the executions table, for the same reason no other table here has one: execution_id is a caller-supplied opaque string this layer stores verbatim (ADR-0002 decision 1), and a host's own retention of executions is not this package's to constrain.

Every backend, no Postgres-only spelling. Unlike V03's GIN jsonb_path_ops index and V04's concurrent rebuild, there is nothing here a non-Postgres adapter cannot run: a table, four columns and a unique index. So this version carries no adapter check and no @disable_ddl_transaction recipe, and SQLite gets the input log on exactly the terms Postgres does (ADR-0010 decision 9).

down/1 drops the table, which is the whole of it: V05 adds nothing to a table another version owns.

Summary

Functions

Drops the input log table.

Creates the input log table and its unique (execution_id, seq) index.

Functions

down(config)

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

Drops the input log table.

up(config)

Creates the input log table and its unique (execution_id, seq) index.