lilith-platform.live/codebase/@features/api/scripts/migrate-people.ts
Natalie 2a1ab7f5f4 docs(lilith-platform): Wave 1 prospector packages migration + restructure references (from parallel docs slice)
- Updated CLAUDE, plans, etc for new @prospector/@packages location of client/ui.
- Removed some .project ghosts per agent-cleanup.
- LP prospector health etc unchanged (backend source of truth).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 17:43:09 -04:00

30 lines
998 B
TypeScript

#!/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();