/** * Shared PostgreSQL Schema Migrator — versioned SQL migrations with advisory locks. * * Extracted from the CMS-specific migrator so that both the CMS and Facts * schemas can reuse the same ordered, transactional migration runner. * * @module */ interface MigrationEntryBase { version: string; name: string; } export type MigrationEntry = MigrationEntryBase & ({ /** Transactional SQL run inside one BEGIN/COMMIT block. */ sql: string; steps?: never; } | { /** * Non-transactional, individually autocommitted SQL statements. * Every step must be idempotent: partial success leaves the version * unrecorded and the next run starts again from step one. */ steps: string[]; sql?: never; }); /** Validate migration definitions before acquiring a connection or lock. */ export declare function validateMigrationEntries(migrations: MigrationEntry[]): void; /** * Run all pending migrations against the given schema. * * Uses a PostgreSQL advisory lock keyed on `lockSeed` + schema name to * serialize concurrent workers. Each migration runs in its own transaction * (or as autocommit steps — see MigrationEntry.steps). * * @param pool - node-postgres pool * @param schema - target schema name (e.g. "copilot_sessions", "pilotswarm_facts") * @param migrations - ordered list of migrations to apply * @param lockSeed - unique seed per system so different schemas don't block each other */ export declare function runMigrations(pool: any, schema: string, migrations: MigrationEntry[], lockSeed: number): Promise; export {}; //# sourceMappingURL=pg-migrator.d.ts.map