v1.6.98 — Postgres JE column gap
A targeted patch closing a gap between the SQLite (desktop) and Postgres (cloud) schemas. The codebase had assumed four columns existed on the journal-entries side for years; SQLite quietly added them in db/init.go’s PRAGMA-gated ALTER block, but the cloud equivalent never got them — the file-based PG migrations stopped at 005. v1.6.98 fixes the cloud side and backfills the historical data that landed in the gap.
What shipped
-
fix PG migration 006 adds the four missing columns idempotently:
journal_entries.source_typejournal_entries.source_idjournal_entries.source_uuidjournal_entry_lines.account_code
Plus two indexes for the source-linkage and account-code lookups that downstream handlers rely on.
-
fix Backfill
account_codeon existing JE-line rows fromaccounts.codevia theaccount_idjoin, so historical entries match what the new posting path writes. -
fix Sync FK map:
journal_entries.source_idadded to the polymorphic exclusion list (alongside the existingreference_identry) so the FK resolver doesn’t try to remap a value that’s polymorphic bysource_typerather than naming a single foreign table.
What was broken
On any cloud tenant before v1.6.98:
postJournalEntryWithDateINSERTs failed silently. The handler code references all four columns; PG rejected the INSERT with SQLSTATE 42703 (column does not exist). On at least one tenant, invoice 11905 — a completed sale — ended up with zero journal entries.- Cancel and return JE-source SELECTs errored with the same SQLSTATE, surfaced by v1.6.97’s swallowed-error fix.
- Backfill migrations v23 / v25 / v26 / v27 / v28 / v35 that re-key by source linkage silently no-op’d on PG because the columns they updated didn’t exist.
Reports for affected periods on those tenants — P&L, Balance Sheet, Trial Balance, GL — were structurally wrong for any sale posted while the column gap was open.
Upgrading
Cloud tenants pick up the migration on next deploy. Desktop tenants are unaffected — SQLite already had the columns. No user action required either way.
Related
- v1.6.99 — the next PG-bridge fix (timestamptz round-trip)
- v1.6.100 — the larger release where most user-visible work lives
- Journal entries — the columns this migration adds, in full context
- Release notes index — full version list