import type { Dialect } from '../dialect.js'; import type { AsyncClient, Client, SqlfuMigrationPreset, SyncClient } from '../types.js'; import { type MigrationHistoryRow } from './preset-queries.js'; export type Migration = { path: string; content: string; }; /** * A migrations bundle as emitted by `sqlfu generate` into * `/.generated/migrations.ts`. Keys are the project-root-relative * path of each migration file (e.g. `"migrations/2020-…_create_posts.sql"`); * values are the file contents. * * The bundle lets runtimes without filesystem access (durable objects, edge * workers, browsers) import migrations as a plain typescript module and apply * them without ever touching `fs`. */ export type MigrationBundle = Record; /** * Convert a `MigrationBundle` (as emitted by `sqlfu generate`) into the * `Migration[]` shape `applyMigrations` consumes. Migrations are returned * sorted by bundle key, which is the same order the CLI applies them in. */ export declare function migrationsFromBundle(bundle: MigrationBundle): Migration[]; export type { MigrationHistoryRow }; /** * @deprecated Use `MigrationHistoryRow`. Retained for back-compat; an alias of * the wider row type that covers both sqlfu and d1 preset shapes. */ export type SqlfuMigrationsRow = MigrationHistoryRow; export declare function migrationName(migration: { path: string; }): string; type HistoryParams = { preset?: SqlfuMigrationPreset; dialect?: Dialect; }; export declare function readMigrationHistory(client: SyncClient, params?: HistoryParams): MigrationHistoryRow[]; export declare function readMigrationHistory(client: AsyncClient, params?: HistoryParams): Promise; export declare function readMigrationHistory(client: Client, params?: HistoryParams): MigrationHistoryRow[] | Promise; type ApplyMigrationsParams = { migrations: Migration[]; preset?: SqlfuMigrationPreset; dialect?: Dialect; }; type BaselineParams = { migrations: Migration[]; target: string; preset?: SqlfuMigrationPreset; dialect?: Dialect; }; export declare function applyMigrations(client: SyncClient, params: ApplyMigrationsParams): void; export declare function applyMigrations(client: AsyncClient, params: ApplyMigrationsParams): Promise; export declare function applyMigrations(client: Client, params: ApplyMigrationsParams): void | Promise; export declare function baselineMigrationHistory(client: SyncClient, params: BaselineParams): void; export declare function baselineMigrationHistory(client: AsyncClient, params: BaselineParams): Promise; export declare function baselineMigrationHistory(client: Client, params: BaselineParams): void | Promise; type ReplaceParams = { migrations: Migration[]; preset?: SqlfuMigrationPreset; dialect?: Dialect; }; export declare function replaceMigrationHistory(client: SyncClient, params: ReplaceParams): void; export declare function replaceMigrationHistory(client: AsyncClient, params: ReplaceParams): Promise; export declare function replaceMigrationHistory(client: Client, params: ReplaceParams): void | Promise;