Stage 2: DB client factory + live integration tests (real Postgres)

- packages/schema/src/client.ts: createDb(url) -> { db, sql } drizzle/postgres-js
  factory. Exposed as the ./client subpath export so the node-only driver never
  leaks into client bundles.
- packages/schema/src/db.integration.test.ts: 6 tests gated behind INTEGRATION=1
  (content insert/read, vault_path UNIQUE, idempotency_key UNIQUE no-double-post,
  content_id FK, audit append, kill-switch upsert). Verified against Postgres 17.
- Default CI suite unchanged: integration tests skip without INTEGRATION.

Closes the Stage 2.1 DoD against a live database (unblocked by Gate 0.8).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Angelo B. J. Luidens
2026-06-03 15:05:31 -04:00
parent 339801966e
commit 7543366a15
4 changed files with 172 additions and 1 deletions
+1
View File
@@ -104,6 +104,7 @@
"version": "0.1.0",
"dependencies": {
"drizzle-orm": "^0.36.0",
"postgres": "^3.4.5",
"zod": "^3.23.0",
},
"devDependencies": {