/**
 * Schema migrations for existing ShieldCortex databases (extracted from
 * src/database/init.ts in v4.26.0 to keep init.ts focused on connection
 * lifecycle).
 *
 * `runMigrations()` is called during `initDatabase()` AFTER the connection is
 * open but BEFORE the inline/file schema (`CREATE TABLE IF NOT EXISTS`)
 * is applied. The split lets us:
 *   - ALTER TABLE pre-existing rows for new columns the schema introduces
 *   - Backfill data into those columns
 *   - Create extra tables (Pro-feature surface, knowledge graph, sync queue)
 *     that the canonical schema file may not yet declare on older installs
 *
 * Most migrations here are idempotent — guarded by either `IF NOT EXISTS`
 * (CREATE TABLE / CREATE INDEX) or a `PRAGMA table_info(...)` check before
 * `ALTER TABLE ADD COLUMN`. The broad try/catch blocks around the larger
 * DDL clusters use `logIfUnexpectedDdlError` to keep idempotent re-runs
 * silent while still surfacing genuinely-unexpected failures (disk full,
 * permission denied, schema corruption, FK conflict).
 *
 * Adding a new migration: add a guarded block at the end of this function.
 * NEVER reorder existing migrations — that breaks upgrade paths on older
 * databases that have only partially run them.
 */
import type Database from 'better-sqlite3';
/**
 * Log unexpected errors from idempotent DDL operations (v4.26.0).
 *
 * Most schema migrations are guarded by either:
 *   - `IF NOT EXISTS` (CREATE TABLE / CREATE INDEX), or
 *   - A PRAGMA check (ALTER TABLE ADD COLUMN, only fires when column missing)
 *
 * Those guards mean the typical re-run case is silent and safe. But the broad
 * `catch {}` blocks that wrap them also swallow genuinely-unexpected failures
 * (disk full, permission denied, schema corruption, FK conflict). This helper
 * filters known-idempotent SQLite errors but surfaces anything else on stderr
 * so the doctor / operator can spot real problems.
 */
export declare function logIfUnexpectedDdlError(err: unknown, op: string): void;
/**
 * Run database migrations for existing databases.
 *
 * Skips entirely on fresh databases (the schema file creates everything in
 * its post-migration form). For existing databases, it walks every
 * column-add / table-create / backfill that has shipped across ShieldCortex
 * v1.x → v4.x.
 */
export declare function runMigrations(database: Database.Database): void;
