-- A merge produces a tiered plan the mesh keeps (novox/hq ADR 0162): what the merge changed and -- everything standing on it, sorted into tiers, each module's state, and the tier the plan is at. -- Kept so a controller replaced mid-plan resumes it, and so `status` can say what a merge still -- waits for. create table release_plan ( id text primary key, repository text not null, commit_hash text not null, created timestamptz not null default now(), updated timestamptz not null default now(), -- building: a tier's builds are asked; rolling: the tier is built and the machines are applying -- what a later tier needs running; done; failed. state text not null, tier int not null default 0, tiers jsonb not null, modules jsonb not null, note text not null default '' ); create index release_plan_open on release_plan (created) where state in ('building', 'rolling');