import { t as Database } from "./types-BCOU_CXE.mjs"; import { Kysely } from "kysely"; //#region src/database/migrations/runner.d.ts /** Ordered names from the statically registered migration set. */ declare const MIGRATION_NAMES: readonly string[]; interface MigrationStatus { applied: string[]; pending: string[]; } interface ExactMigrationStatus { knownApplied: string[]; pending: string[]; unknownApplied: string[]; } interface MigrationOptions { migrationTableSchema?: string; /** * Override how long to wait for a concurrent migrator to finish before * giving up. Defaults to MIGRATION_RACE_WAIT_MS; tests shorten it so the * give-up path doesn't take 10 seconds per case. */ raceWaitMs?: number; } /** * Get migration status */ declare function getMigrationStatus(db: Kysely, options?: MigrationOptions): Promise; /** * Read exact migration status without invoking Kysely's migration * introspection. Registered names retain execution order; unknown database * records are sorted so reports remain stable across dialects. */ declare function getExactMigrationStatus(db: Kysely, options?: MigrationOptions): Promise; /** * Run all pending migrations. * * Includes a fast-path: if the migration table already exists and contains * at least MIGRATION_COUNT rows, all migrations this build knows about have * been applied and we can skip the Kysely Migrator entirely. This avoids * the expensive `pragma_table_info` introspection that Kysely runs for * every table in the database (twice!) just to check if the migration * tables exist. On D1 with ~57 tables, that's ~116 queries saved per init. * * Concurrent-migration safety: the Kysely Migrator's `acquireMigrationLock` * is a no-op for SQLite (and therefore D1), so two callers running this * concurrently against the same database will both try to apply pending * migrations. SQLite serializes the writes, but the loser still surfaces a * `UNIQUE constraint failed: _emdash_migrations.name` error. We treat that * specific error as benign: another caller is already applying the same * schema. We wait for the concurrent migrator to finish, then return * success. This matches the user-observable expectation that running * migrations twice in a row is a no-op. */ declare function runMigrations(db: Kysely, options?: MigrationOptions): Promise<{ applied: string[]; }>; /** * Rollback the last migration */ declare function rollbackMigration(db: Kysely, options?: MigrationOptions): Promise<{ rolledBack: string | null; }>; //#endregion export { getMigrationStatus as a, getExactMigrationStatus as i, MIGRATION_NAMES as n, rollbackMigration as o, MigrationStatus as r, runMigrations as s, ExactMigrationStatus as t }; //# sourceMappingURL=runner-Bnq68jCZ.d.mts.map