-- Builds, rollouts and assignments move to the bus (novox/hq ADR 0408 ยง8, design 47 milestone 5, issue 1089). -- -- This migration makes the switch alone. The rows of build, build_request, release_plan, batched_merge, assignment and -- pending_assignment are written into the chain's buckets by the serving controller at its start, holding the lease, -- because a migration runs when the store is opened, before any connection to the bus. This row is the switch: while it -- is absent nothing reads the buckets; once the move has counted every row against the keys it wrote, it is written, and -- nothing reads the tables. One row at most; never written by a migration, so a delivery alone changes nothing. The -- controller keeps no consolidated schema, so this migration is the whole of the change; the tables go by a later one. create table chain_moved ( only_one boolean primary key default true check (only_one), moved_at timestamptz not null default now(), -- The counts the move read from the tables and wrote as keys, per kind, and the largest value it wrote: what a -- reader of the move reads back. counts jsonb not null, largest jsonb not null ); -- A seat's holder was an assignment by a foreign key; the assignments are keys of the bus once moved, so the controller says -- it (HoldSeat refuses a holder that is not assigned) and an unassignment takes the holding with it (Unassign), as the -- key's `on delete cascade` did. alter table seat_holding drop constraint seat_holding_node_module_fkey;