feat: replace SQLite with Postgres via Apple Container#35
Merged
Conversation
cd427b4 to
6455561
Compare
…andler to test update
- Rewrite test helper with per-test Postgres schema isolation - Update all test files to pass t context and use pool - Simplify health handler to Postgres-only queries - Update health test fakes to use .query() instead of .prepare() - Run tests serially (jobs: 1) for reliability with shared Postgres DB - Update envrc, docs, and remove SQLite artifacts
7c8a1b9 to
e119d59
Compare
till
reviewed
Jun 21, 2026
Address review feedback: the container previously had no data volume, so every stop/start destroyed the database. - Mount named volume auth-dev-pg-data for /var/lib/postgresql/data - stop now only stops the container (data survives) - New destroy command wipes container + volume explicitly - start reuses stopped containers instead of recreating - status distinguishes running/stopped/not-created
- Keep Postgres-only approach (removes SQLite as per PR intent) - Preserve SSL config and error handler from main - Remove duplicate db declaration
CI Postgres service does not support SSL. Only enable SSL for non-localhost connections (e.g. Heroku production).
ed239ba to
ea91806
Compare
till
approved these changes
Jun 21, 2026
till
left a comment
Collaborator
There was a problem hiding this comment.
I would probably squash this into one or two commits. But that's just my preference.
Other lgtm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In upcoming work I was seeing more and more branching, that made it clear that running tests in SQLite would just add more overhead and problems, than the benefits it provides.
Hence, this PR :smiling:
Summary
Replace SQLite with PostgreSQL running in an Apple Container for tests and local development.
Changes
scripts/container.shmanages a Postgres:16-alpine container (start/stop/status/logs/ensure).test/helpers/container.jsverifies prerequisites on startup.src/auth.jsalways usespg.Pool— SQLite branches removed. Config defaults to local container Postgres.getTestInstance(t)creates a per-test Postgres schema with auto-teardown viat.teardown(). All 6 test files updated to passtand usepool..query().AGENTS.md,README.md,docs/development.md..envrc-distupdated.dev,test,db:generate,db:migrate.Testing
.taprcusesjobs: 1for reliability with shared Postgres databaseLocal Setup
brew install containercontainer system startnpm ci && npm run db:generate && npm run db:migrate && npm run devdocs/development.mdfor detailsRelated
Closes the SQLite-to-Postgres migration.