Decision 0004 · Accepted · 2026-11-22

Embedded migrations applied under an advisory lock

Context

The service ships as a single container. A separate migration tool or job adds moving parts, and two instances starting together could race on schema changes.

Decision

Embed numbered SQL files in the binary (go:embed) and apply them on boot inside a PostgreSQL advisory lock. Applied files are immutable; changes are new files.

Consequences

← 0003 Interfaces at the edges (LLM, store) for testability0005 HMAC-hashed IPs and file-based secrets →