import { SqliteConnection } from "../connection.js"; //#region src/migrations/registry.d.ts /** * Single source of truth for the bundled migration SQL files. The runner * loads them in numeric order, applies them inside a single transaction, * and records the applied version in `schema_migrations`. * * Bundled migrations live alongside this file (`*.sql`) and are read at * package load time. The file name format is mandatory: * `NNN-.sql`, where `NNN` is a zero-padded sequence number. * * Future packages register additional migrations by appending entries * to {@link registerMigration} during their package initialization. * * @stable */ interface Migration { /** Zero-padded sequence number - must be globally unique. */ readonly version: string; /** Human-readable slug, e.g. `'memory'`. */ readonly name: string; /** Raw SQL body (multi-statement). */ readonly sql: string; /** Owning module - surfaced in error messages. */ readonly owner: string; /** * Optional data-repair hook. The runner invokes it INSIDE the * migration's transaction, immediately BEFORE `sql`, and only when * the migration is actually pending. It exists so a migration whose * DDL cannot tolerate pre-existing bad data (e.g. a CREATE UNIQUE * INDEX over rows that already contain duplicates) can repair that * data first WITHOUT editing the SQL file - the file stays * byte-identical, so the checksum tamper-guard keeps holding for * databases that already applied the version. */ readonly preflight?: (conn: SqliteConnection) => void; } /** * Returns the full ordered migration list (built-ins + any registered * dynamic migrations). Sorted by `version`. Verifies that no two entries * share the same version. * * @stable */ declare function listMigrations(): readonly Migration[]; /** * Register a runtime-supplied migration. Used by downstream packages * that want to ship their schema alongside the bundled set without * forking this package. * * @stable */ declare function registerMigration(migration: Migration): void; /** * Test-only helper. Drops every dynamically-registered migration so a * test can rebuild a clean registry without leaking state across cases. * * @internal */ declare function _resetDynamicMigrationsForTesting(): void; //#endregion export { Migration, _resetDynamicMigrationsForTesting, listMigrations, registerMigration }; //# sourceMappingURL=registry.d.ts.map