diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-20 14:53:46 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-20 14:53:46 +0200 |
| commit | 480640a747b81cb39deb1ec24e6e199a9c837fbe (patch) | |
| tree | a0823b8a06f2043061f4b61b1cd0b060b85ec68e /docs | |
| parent | 8607260080dd1eca2d724d6e5b07622fad2d4ac8 (diff) | |
| download | bokf-480640a747b81cb39deb1ec24e6e199a9c837fbe.tar.gz bokf-480640a747b81cb39deb1ec24e6e199a9c837fbe.zip | |
db: schema v9 for invoicing, vouchers source rebuild
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/SCHEMA.md | 16 | ||||
| -rw-r--r-- | docs/STATE.md | 7 |
2 files changed, 18 insertions, 5 deletions
diff --git a/docs/SCHEMA.md b/docs/SCHEMA.md index 0f360d5..15e375a 100644 --- a/docs/SCHEMA.md +++ b/docs/SCHEMA.md @@ -202,7 +202,8 @@ CREATE TABLE vouchers ( date TEXT NOT NULL CHECK (date LIKE '____-__-__'), description TEXT NOT NULL CHECK (length(description) > 0), source TEXT NOT NULL DEFAULT 'manual' - CHECK (source IN ('manual','agent','sie_import','system','ib')), + CHECK (source IN ('manual','agent','sie_import','system','ib', + 'invoice')), client_ref TEXT, corrects_voucher_id INTEGER, created_at TEXT NOT NULL, @@ -576,7 +577,18 @@ another voucher is posted in between) — clients must not persist it. (thousands of vouchers per year are trivial). Attachments dominate growth; they live in the same file so a snapshot remains a single artifact. -## 14. Seeds +## 14. Invoicing (schema v9) + +`customers`, `invoice_sequence`, `invoices` and `invoice_rows` hold the +customer register, the per-org global invoice number series and issued +invoices with their rows. They are business documents, not ledger data: +invoices are written once at issue and only their status and send fields +change afterwards. The DDL and field semantics are in `docs/INVOICING.md` +§6. `vouchers.source` gained `'invoice'`; widening that CHECK required +rebuilding the table in the v9 migration (foreign keys are disabled for the +migration and `PRAGMA foreign_key_check` runs before they are re-enabled). + +## 15. Seeds | Data | Source | Notes | |---|---|---| diff --git a/docs/STATE.md b/docs/STATE.md index 97d0e8d..428bb79 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -280,9 +280,10 @@ check. - Never commit unless the human asks. - SQLite files must not be backed up live with restic; use `backup.snapshot` (`VACUUM INTO`) and point restic at the snapshots. -- Schema version is 7 (v3 moms rules; v4/v6 year info; v5 org - description/shares + board members; v7 attachments append-only triggers); - forward migrations are in `db.c`. +- Schema version is 9 (v3 moms rules; v4/v6 year info; v5 org + description/shares + board members; v7 attachments append-only triggers; + v8 bank reconciliation; v9 invoicing + widened `vouchers.source` with a + table rebuild); forward migrations are in `db.c`. ## Makandra driftstatus (org 2) |
