Skip to content

Local-first database: containerized Postgres, portable anywhere - #16

Merged
trac41799 merged 1 commit into
mainfrom
docs/acceptance-run-6
Sep 30, 2026
Merged

trac41799 merged 1 commit into
mainfrom
docs/acceptance-run-6

Conversation

@trac41799

Copy link
Copy Markdown
Owner

Implements the local-first database design: containerized Postgres on this machine, portable anywhere later via Prisma.

What it does

  • Postgres-backed stacks no longer hard-require a Supabase cloud project: with no cloud config, provision boots postgres:16-alpine via the scaffolded docker-compose.yml (port 54322, healthcheck, named volume), waits for healthy, and records a database_targets row. Cloud config still wins when present.
  • npm install phase also applies the Prisma schema (migrate deploy with a migrations dir, else db push); a schema that can't be applied fails the run.
  • New verification check database reachable + schema applied runs the reachability + per-model to_regclass queries through the project's own Prisma toolchain (npx prisma db execute --stdin) — same path the app uses. Skips cleanly without a schema.
  • Scaffold emits docker-compose.yml and defaults DATABASE_URL to the local container; the Supabase-cloud URL stays as a commented migration template.
  • Daemon down (Docker Desktop not running) pauses as awaiting_user with an actionable message — never a cryptic failure.

Verification

  • 7 new unit tests + full gates (235 lib, 42 integration).
  • A self-skipping live test boots a real container + psql roundtrip + teardown; it runs automatically once Docker is up (the engine was still starting at ship time — exact commands in LOCAL-DATABASE.md).
  • Traceability: docs/2026-09-26-defect-closure/handoffs/LOCAL-DATABASE.md (design, migration-anywhere story, follow-ups).

Known follow-ups (in the handoff doc)

Target-status UI command, express-stack schema, app-tier DB health ping, password-change refresh rule.

@vercel

vercel Bot commented Sep 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
source-forge Ready Ready Preview Sep 30, 2026 4:27pm UTC

@trac41799
trac41799 merged commit a5043f4 into main Sep 30, 2026
8 checks passed
Postgres-backed stacks fall back to a local Docker Postgres (pinned postgres:16-alpine, port 54322, healthcheck, volume) when no Supabase cloud config exists. Adds migration 018 database_targets, the database.rs provision/schema/check module, scaffold compose + local-first DATABASE_URL, a prisma-toolchain verification check, and schema apply in the pipeline. Daemon-down pauses as awaiting_user. Tests: 7 new unit + a self-skipping live container test. Design + E2E steps in LOCAL-DATABASE.md. Gates: 235 lib + 42 integration.

This branch was successfully deployed

1 active deployment
Preview — b0392e7e Deployed Sep 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant