Skip to content

The schema is SQLite-only, self-hosting included - #2

Merged
lessevv merged 1 commit into
mainfrom
docs/sqlite-only-schema
Jul 27, 2026
Merged

The schema is SQLite-only, self-hosting included#2
lessevv merged 1 commit into
mainfrom
docs/sqlite-only-schema

Conversation

@lessevv

@lessevv lessevv commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Walking the self-hosting instructions on a clean machine found that the
documented "Docker Compose (recommended)" path cannot work. The shipped
deploy/server/ stack runs postgres:16-alpine, and artisan migrate
against it fails on the first substantive table:

SQLSTATE[42601]: syntax error at or near "NEW"
SQL: CREATE TRIGGER transactions_type_check_insert BEFORE INSERT ON transactions
     FOR EACH ROW WHEN NEW.type NOT IN (...) BEGIN SELECT RAISE(ABORT, '...'); END

That contradicts a claim in ADR-0005 — "the migration path is preserved: no
SQLite-only schema feature is used"
. A survey found 32 migrations using
RAISE(ABORT) triggers plus an FTS5 virtual table for search.

The triggers would port mechanically. FTS5 would not — search would need
rebuilding on tsvector. ADR-0022 takes the honest position the code already
takes: SQLite everywhere, and the Postgres/MySQL options withdrawn.

ADR-0005's decision is unchanged and reinforced; only its portability claim is
superseded, and the records link both ways per GOV-R9.

Merges before the product-repo change that fixes the deployment guide and
rebuilds deploy/server/ on SQLite.

ADR-0005 rejected PostgreSQL and left the door open, recording that no
SQLite-only schema feature was in use so a move would stay a
framework-level concern. That stopped being true and nothing tested it.

Walking the self-hosting instructions on a clean machine surfaced it: the
shipped deploy/server/ stack runs postgres:16-alpine, and migrate fails
on the first substantive table with a syntax error at "NEW" — the
transactions enum-guard trigger is SQLite syntax. Thirty-two migrations
use RAISE(ABORT) triggers, and search is an FTS5 virtual table.

The triggers would port mechanically. FTS5 would not: full-text search
would have to be rebuilt on tsvector, with its own indexing, ranking and
index migration. That is a project, in service of a use case nobody has
asked for — one household is not a workload SQLite struggles with.

ADR-0022 records SQLite as the only supported database in every shape and
withdraws the Postgres and MySQL options from the deployment guide, which
described something that could not work. ADR-0005's decision is unchanged
and reinforced; only its portability claim is superseded, and the two
records now point at each other.

Signed-off-by: Wessel Verheij <info@nightworks.io>
@lessevv
lessevv merged commit 80c9dbd into main Jul 27, 2026
12 checks passed
@lessevv
lessevv deleted the docs/sqlite-only-schema branch July 27, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant