/**
 * Custom umzug storage adapter for better-sqlite3.
 *
 * Wraps better-sqlite3's synchronous API in async methods to satisfy
 * umzug's UmzugStorage interface. Manages the `umzug_migrations` tracking
 * table with columns: name (TEXT PK) and created_at (TEXT NOT NULL).
 *
 * Includes a bootstrap seeder that auto-detects existing databases
 * (PRAGMA user_version > 0 with empty umzug_migrations table) and seeds
 * migration records for versions 1 through user_version.
 */
import type Database from 'better-sqlite3';
import type { UmzugStorage, MigrationParams } from 'umzug';
/**
 * SQLite-backed migration storage for umzug.
 *
 * Tracks which migrations have been applied in a `umzug_migrations` table
 * within the same SQLite database as the application data.
 */
export declare class SQLiteMigrationStorage implements UmzugStorage<Database.Database> {
    private readonly db;
    /**
     * @param db - The better-sqlite3 database instance.
     * @param legacyMigrationNames - Ordered list of legacy migration names (e.g.,
     *   ['001-create-settings-table', '002-add-agent-config', ...]). When provided,
     *   the constructor checks if this is an existing database transitioning from
     *   PRAGMA user_version tracking and seeds the umzug_migrations table accordingly.
     */
    constructor(db: Database.Database, legacyMigrationNames?: string[]);
    /**
     * Mapping of legacy migration names to the tables they create.
     * Used by verifyBootstrappedMigrations to detect migrations that were
     * marked as executed by the bootstrap seeder but never actually ran.
     */
    private static readonly MIGRATION_TABLE_MAP;
    /**
     * Returns the names of all executed migrations, sorted lexicographically.
     */
    executed(_meta: Pick<MigrationParams<Database.Database>, 'context'>): Promise<string[]>;
    /**
     * Records a migration as executed.
     */
    logMigration(params: MigrationParams<Database.Database>): Promise<void>;
    /**
     * Removes a migration record (marks it as pending).
     */
    unlogMigration(params: MigrationParams<Database.Database>): Promise<void>;
    /**
     * Creates the umzug_migrations table if it does not exist.
     */
    private ensureTable;
    /**
     * Auto-detects existing databases that used PRAGMA user_version tracking
     * and seeds the umzug_migrations table so umzug does not re-apply them.
     *
     * Conditions for bootstrap:
     * - PRAGMA user_version > 0 (database has been migrated before)
     * - umzug_migrations table is empty (not yet transitioned to umzug)
     *
     * When both conditions are met, inserts records for migrations 1 through
     * user_version using the provided legacy migration names.
     */
    private bootstrapLegacyMigrations;
    /**
     * Checks that each bootstrapped migration's expected table actually exists.
     * Only checks migrations that were seeded (present in seededNames).
     * If a table is missing, removes the migration record from umzug_migrations
     * so that umzug will re-run it on the next up() call.
     */
    private verifyBootstrappedMigrations;
}
//# sourceMappingURL=sqlite-migration-storage.d.ts.map