mix ash_onetime.gen.migrations (ash_onetime v1.9.2)

Copy Markdown View Source

Generates the PostgreSQL objects required by ash_onetime.

mix ash_onetime.gen.migrations --repo MyApp.Repo
mix ash_onetime.gen.migrations --repo MyApp.Repo --claims hash --claim-partitions 8
mix ash_onetime.gen.migrations --repo MyApp.Repo --fact-tables ledger_facts,payment_facts

--fact-tables additionally generates the append-only fact tables backing context_boundary declarations (one migration creating every named table). Use --tenants to write to the repo tenant migration directory.

Summary

Functions

Renders the install migration deterministically for explicit options.

Renders the context-boundary fact-table migration deterministically for explicit options. Every table name is validated by AshOnetime.Resource.ContextBoundary.validate_fact_table/1; the migration creates each table (identity seq, GIN-indexed tags, tenant scoping, append-only trigger) and is reversible. Pure (no filesystem writes).

Renders the reversible logical-partition upgrade for an existing installation.

Renders the SEC-5/SEC-6 forward migration deterministically for existing installs: the response_partition index, a back-fill of monthly partitions from partition_start through partition_start + months, and the past-retention DEFAULT drain. Pure (no filesystem writes).

Functions

render(repo, options)

@spec render(module(), keyword()) :: binary()

Renders the install migration deterministically for explicit options.

render_fact_tables(repo, options)

@spec render_fact_tables(module(), keyword()) :: binary()

Renders the context-boundary fact-table migration deterministically for explicit options. Every table name is validated by AshOnetime.Resource.ContextBoundary.validate_fact_table/1; the migration creates each table (identity seq, GIN-indexed tags, tenant scoping, append-only trigger) and is reversible. Pure (no filesystem writes).

render_logical_partition_upgrade(repo, options)

@spec render_logical_partition_upgrade(module(), keyword()) :: binary()

Renders the reversible logical-partition upgrade for an existing installation.

render_roll_forward(repo, options)

@spec render_roll_forward(module(), keyword()) :: binary()

Renders the SEC-5/SEC-6 forward migration deterministically for existing installs: the response_partition index, a back-fill of monthly partitions from partition_start through partition_start + months, and the past-retention DEFAULT drain. Pure (no filesystem writes).