mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 06:43:06 +00:00
Local dev and the test suite previously defaulted to the live production Neon database, and running the tests mutated prod data. Add guardrails plus a proper local Postgres + migrations workflow so production can't be hit by mistake: - docker-compose: local Postgres 17 (matches prod) + auto-created teqo_test - dev guard refuses a non-local DATABASE_URL; tests refuse non-_test databases - .env.test isolates the suite; vitest/playwright load it and fail closed - Payload migrations set up (push disabled); build runs `payload migrate`, so deploys apply pending migrations to prod automatically - baseline `initial` migration + idempotent consent.text varchar->jsonb fix - `pnpm db:pull` copies prod content locally, excluding supporter PII - docs (README, AGENTS.md) + agent skills for the local-db/migration workflow
11 lines
519 B
TypeScript
11 lines
519 B
TypeScript
// Load the isolated test environment — NEVER .env / .env.local, which point at
|
|
// the production database. `override: true` guarantees the test database wins
|
|
// even if a prod DATABASE_URL is already exported in the shell.
|
|
import { config as loadEnv } from 'dotenv'
|
|
|
|
import { assertTestDatabase } from './tests/helpers/assertTestDatabase'
|
|
|
|
loadEnv({ path: '.env.test', override: true })
|
|
|
|
// Fail closed: refuse to run the (destructive) suite against a non-test database.
|
|
assertTestDatabase(process.env.DATABASE_URL)
|