import type { Database } from "../../shared/sqlite";
export declare class MigrationLockBusyError extends Error {
    constructor(message: string);
}
/**
 * Highest version in the MIGRATIONS array. `LATEST_SUPPORTED_VERSION` in
 * storage-db.ts (the schema-fence ceiling) MUST equal this — a stale ceiling
 * makes the DB refuse to open after the new migration applies (a real bug the
 * project hit during v2 work). A unit test asserts the two stay in lockstep.
 */
export declare const LATEST_MIGRATION_VERSION: number;
/**
 * Detect the specific case where a sibling process already committed the
 * same `schema_migrations` row we're about to insert. BEGIN IMMEDIATE now
 * prevents this race for supported adapters by serializing before the version
 * read. Keep this narrow guard as a secondary backstop for legacy or unusual
 * transaction adapters that do not honor the requested begin mode.
 *
 * Important: only PRIMARY KEY conflicts on `schema_migrations` are
 * swallowed. Any other failure (CREATE TABLE, ALTER TABLE, data heal,
 * etc.) surfaces normally and fail-closes per contract.
 */
export declare function isSiblingMigrationConflict(db: Database, error: unknown, version: number): boolean;
/**
 * Run all pending migrations sequentially.
 * Each migration runs in its own transaction — if it fails, only that migration rolls back.
 * Already-applied migrations are skipped.
 *
 * Migration application re-reads the persisted version under BEGIN IMMEDIATE
 * before choosing one migration. Concurrent starters therefore serialize before
 * taking a read snapshot: one applies the migration and the waiter observes the
 * advanced version instead of failing a deferred read-to-write lock upgrade.
 */
export declare function runMigrations(db: Database): void;
/**
 * Run migrations without blocking the event loop while a sibling owns SQLite's
 * write lock. Only failures from the lock/check phase are retried; migration
 * body failures continue to fail closed immediately.
 */
export interface MigrationRetryOptions {
    retryDelaysMs?: readonly number[];
    sleep?: (delayMs: number) => Promise<void>;
}
export declare function runMigrationsWithRetry(db: Database, options?: MigrationRetryOptions): Promise<void>;
//# sourceMappingURL=migrations.d.ts.map