Files
decision/crates/ld-server/migrations/0010_vote_buffer.sql
T

20 lines
1.1 KiB
SQL

-- The buffer of the votes (2026-11-02, lot V, ADR 0012). Additive only: no
-- existing row is rewritten; an older image (rollback) reads the same tables.
--
-- A ballot is the intention of a vote, seen at once; its proof comes from the
-- chain (mode 'chain'), or, while the chain is closed, from the simulated
-- confirmer (mode 'simulated': no account, no amount, the voice of the session).
-- After each proof, the reconciliation keeps one voice per identity and per
-- version, the last in the order of the chain, and tells each proven line what
-- became of it.
ALTER TABLE ballots ADD COLUMN mode TEXT NOT NULL DEFAULT 'chain'; -- chain | simulated
ALTER TABLE ballot_lines ADD COLUMN outcome TEXT; -- counted | superseded | objection (NULL: not proven yet, or proven before 0010)
-- The intentions of a document, read with every view of it.
CREATE INDEX ballots_doc ON ballots(doc_id, status);
-- `votes.source` takes one more value, 'simulated'; `messages.topic` one more,
-- 'ballot' (kinds ballot_expired | ballot_refused | ballot_objection): text
-- columns, nothing to change.