/** * `cleo doctor migrations`: the migration journal of each store, read-only * (journal spec ยง2.3a rule 2, "journal safety check"; R5-3 T12796). * * Every S2+ acceptance run reads the live journal count through this report, * never through a literal: per scope, the journal's row count and head row, * and per lineage sharing that journal, how many of its migration files are * applied, which are pending, and any drift (a journal row with a local * migration's name but a different hash, the #1719 condition). Rows no known * lineage explains are listed too. * * A journal rebuilt from empty on a store that already held its schema (most * likely by a vault restore before T13104, which emptied it) is named, with * how many rows the migrator stamped applied without running their SQL. * * The store is opened as a read-only snapshot; nothing is written. * * @module * @task T12796 * @task T13104 */ import { type DualScope } from '../store/dual-scope-db.js'; /** Lineages the project store's journal runs (the consolidated one first). */ export declare const PROJECT_LINEAGES: readonly string[]; /** Lineages the global store's journal runs. */ export declare const GLOBAL_LINEAGES: readonly string[]; /** A journal rebuilt on a store that already held its schema (T13104). */ export interface RebuiltJournalReport { /** Rows recorded applied without their SQL having run on this file (`applied_at` NULL). */ readonly stamped: number; /** What happened and what it means. */ readonly detail: string; } /** One lineage's standing in a journal. */ export interface LineageMigrationReport { readonly lineage: string; /** Migration files in the installed folder. */ readonly local: number; /** Local files whose hash is in the journal. */ readonly applied: number; /** Local files whose name is not in the journal. */ readonly pending: string[]; } /** One journal row, as the report shows it. */ export interface JournalRowReport { readonly id: number; readonly name: string | null; readonly hash: string; } /** A store's migration journal. */ export interface ScopeMigrationReport { readonly scope: DualScope; readonly dbPath: string; readonly exists: boolean; /** Rows in `__drizzle_migrations`. */ readonly journalRows: number; /** The row with the largest id. */ readonly head: JournalRowReport | null; readonly lineages: LineageMigrationReport[]; /** Rows named like a local migration whose hash differs (#1719 drift). */ readonly drift: Array; /** Rows no installed lineage knows (a newer build, or a foreign lineage). */ readonly unknown: JournalRowReport[]; /** * Set when the journal opens with the consolidated baseline stamped applied * (`applied_at` NULL) instead of run: the migrator rebuilt it from empty on a * store that already held the schema. `null` otherwise. */ readonly rebuilt: RebuiltJournalReport | null; } /** The report of every scope. */ export interface MigrationsReport { readonly scopes: ScopeMigrationReport[]; } /** * Inspect one store's journal. Read-only. * * @param scope - Which store. * @param dbPath - The store file. * @param lineages - Lineages to report (installed folders). Every consolidated * lineage still counts as known for drift and unknown rows. * @param folderOf - Folder resolver (tests pass their own). */ export declare function inspectJournal(scope: DualScope, dbPath: string, lineages?: readonly string[], folderOf?: (lineage: string) => string): ScopeMigrationReport; /** * The migration journals of the project store (at `projectRoot`) and the * global store. Read-only. */ export declare function inspectMigrations(projectRoot: string): MigrationsReport; //# sourceMappingURL=migrations.d.ts.map