/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { JsonSchema } from "@workglow/util/schema"; import { type ITabularMigrationApplier, type TabularMigrationOp } from "../migrations"; import { type AnyTabularStorage } from "./ITabularStorage"; /** * SQL-flavored {@link ITabularMigrationApplier}. Subclasses (one per dialect) * provide the connection-level primitives (`exec`, `tableExists`, * `withTransaction`) and the JSON-Schema-to-SQL mapper. The applier handles * op translation, atomicity, and bookkeeping. * * `applyMigration` runs all ops + the bookkeeping INSERT inside a single * `withTransaction` so DDL, backfill writes, and applied-version recording * commit (or roll back) together on backends that support real transactions. */ export declare abstract class SqlTabularMigrationApplier implements ITabularMigrationApplier { protected abstract dialectName(): "sqlite" | "postgres"; protected abstract table(): string; protected abstract storage(): AnyTabularStorage; protected abstract mapTypeToSQL(typeDef: JsonSchema): string; protected abstract isNullableSchema(typeDef: JsonSchema): boolean; protected abstract executeSql(sql: string): Promise; protected abstract executeSqlTx(sql: string, tx: AnyTabularStorage): Promise; protected abstract recordAppliedTx(component: string, version: number, description: string | undefined, tx: AnyTabularStorage): Promise; protected abstract recordApplied(component: string, version: number, description: string | undefined): Promise; protected abstract queryAppliedVersions(component: string): Promise>; protected abstract probeTableExists(): Promise; ensureBookkeeping(): Promise; appliedVersions(component: string): Promise>; tableExists(): Promise; markAllApplied(component: string, versions: ReadonlyArray<{ version: number; description: string | undefined; }>): Promise; applyMigration(component: string, version: number, description: string | undefined, ops: ReadonlyArray, onProgress?: (fraction: number) => void): Promise; protected applyOp(op: TabularMigrationOp, tx: AnyTabularStorage): Promise; /** * Renders a JS literal as SQL. Strings are quoted with `'` doubling; * numbers / booleans / null are rendered raw. NaN / ±Infinity throw * rather than silently splicing as `"NaN"` / `"Infinity"` (neither is * valid SQL). Objects throw — defaults must be finite primitives. */ protected literalSql(value: unknown): string; /** * DDL for the bookkeeping table. Same shape used by the existing * per-driver runners. */ protected bookkeepingDdl(): string; } //# sourceMappingURL=SqlTabularMigrationApplier.d.ts.map