/** * Migrations Doctor * * Diagnoses and (with --rebuild-journal) repairs drift between * `quickback/drizzle//*.sql`, `_journal.json`, and `_snapshot.json`. * * The compiler refuses to emit new migrations when this state is inconsistent * (see apps/compiler/src/utils/validate-migration-state.ts) because drizzle-kit * silently skips emission against a stale diff base, producing a compile that * appears successful while shipping a Worker that 500s on the new tables. * * Usage: * quickback migrations doctor # diagnose only * quickback migrations doctor --rebuild-journal # rebuild _journal.json from on-disk .sql filenames */ type JournalDialect = 'sqlite' | 'postgresql'; interface JournalEntry { idx: number; version?: string; when?: number; tag: string; breakpoints?: boolean; } export interface DirState { name: string; absolutePath: string; metaPath: string; /** * Journal dialect: read from the existing _journal.json when present, * else inferred from the layout (root layout → postgresql, per-database * subdir → sqlite). rebuildJournal MUST honor this — writing a sqlite * journal into a pg project would silently corrupt the migration state. */ dialect: JournalDialect; hasJournal: boolean; journalEntries: JournalEntry[]; journalVersion: string | undefined; sqlFiles: Array<{ filename: string; idx: number; tag: string; mtimeMs: number; }>; snapshotFiles: Array<{ filename: string; idx: number; id?: string; prevId?: string; }>; } export interface DirIssue { severity: 'error' | 'warn'; message: string; } export declare function migrations(args: string[]): Promise; export declare function collectDirStates(drizzleRoot: string): Promise; export declare function inspectDir(dir: DirState): DirIssue[]; export declare function rebuildJournal(dir: DirState): Promise; export {}; //# sourceMappingURL=migrations.d.ts.map