/** * @license * Copyright 2025 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { IMigration, MigrationProgressListener } from "./IMigration"; /** * Name of the bookkeeping table used by every runner. The leading underscore * is intentional — it sorts before user tables in catalog views and signals * "system table, don't touch". */ export declare const MIGRATIONS_TABLE = "_storage_migrations"; /** * Optional knobs accepted by {@link IMigrationRunner.run}. * * `onProgress` is invoked synchronously from inside the migration's * transaction (or upgrade callback for IndexedDB), so listeners must NOT * await IO that touches the same database — they would deadlock against * the open transaction. Use them for logging, telemetry, or in-memory * progress UI updates. */ export interface RunMigrationsOptions { readonly onProgress?: MigrationProgressListener; } /** * Common runner contract — runs the supplied migrations in (component, version) * order, skipping any that have already been recorded. Returns the migrations * that were actually applied this call (useful for logging/tests). * * Concrete runners live in driver-specific packages (`@workglow/postgres`, * `@workglow/sqlite`) so that `@workglow/storage` does not have to depend on * any database driver. */ export interface IMigrationRunner { ensureBookkeepingTable(): Promise; appliedVersions(component: string): Promise>; run(migrations: ReadonlyArray>, options?: RunMigrationsOptions): Promise>>; } /** * Stable sort by `(component asc, version asc)`. Exposed so concrete runners * in driver packages don't need their own copy. */ export declare function sortMigrations(migrations: ReadonlyArray>): IMigration[]; //# sourceMappingURL=MigrationRunner.d.ts.map