MimirAnalytics.Schema (mimir_analytics v0.8.1)

Copy Markdown View Source

Canonical run-record DDL. Tables are created if absent, then missing columns are added to existing tables. apply/1 is idempotent.

Column additions to existing tables need an entry in @column_migrations; CREATE TABLE IF NOT EXISTS alone does not change their columns.

Summary

Functions

Create every table, then add any columns an older database lacks.

Functions

apply(conn)

@spec apply(reference()) :: :ok | {:error, :name_keyed_ledger}

Create every table, then add any columns an older database lacks.

Returns {:error, :name_keyed_ledger}, changing nothing, when the database holds an ingest_ledger from before the ledger was keyed by content digest. Its entries name files, not contents, so they cannot tell whether a file that has since grown was fully read. Such a database is rebuilt, not migrated: delete it and re-ingest the source directories (README, "Upgrading a database").

tables()

@spec tables() :: [String.t()]