#!/usr/bin/env bun /** * Safe standalone migrator for the people_* central tableset. * * Per database-architecture.md: * - NEVER run on prod without: * 1. pg_dump backup of black quinn DB. * 2. Rehearse on scratch/test DB first. * 3. Verified rollback. * 4. Explicit user confirmation. * 5. For prod: manage-apps stop quinn.api (INTERNAL), apply, watch logs, start. * * Usage (test only first): * QUINN_DB_URL=postgres://user:pass@host:port/testdb bun run scripts/migrate-people.ts */ import { openDb, runMigrations } from '@/shared/db'; import { peopleMigrations } from '@/entities/people'; const url = process.env.QUINN_DB_URL; if (!url) { console.error('Set QUINN_DB_URL (use scratch/test DB first!)'); process.exit(1); } console.log('Rehearsing people migrations on', url.replace(/:[^@]+@/, ':***@')); const db = openDb(url); await runMigrations(db, peopleMigrations); console.log('SUCCESS: people_* tables, views, and bridge columns applied.'); await db.end();