/** * SQLite connection management and schema migrations for ContextAtlas. * * The storage schema is an extension of DESIGN.md's documented tables. * In addition to the three query tables (symbols, claims, claim_symbols), * we persist three artifact-metadata tables so that atlas.json round-trip * is lossless per ADR-06: * * - `_meta` — internal schema version bookkeeping (not user-visible) * - `atlas_meta` — top-level atlas.json fields (version, generated_at, * generator info) stored as key/value rows * - `source_shas` — the path→sha map of prose docs that fed extraction * * Migrations are expressed as code. Adding a v2 appends one entry to * `MIGRATIONS`; the runner applies everything above the current version * inside a single transaction per migration. */ import { type Database as DatabaseInstance } from "better-sqlite3"; export declare const LATEST_SCHEMA_VERSION: number; export interface OpenDatabaseOptions { /** If true, enable SQLite foreign key enforcement. Default: true. */ foreignKeys?: boolean; /** If true, open read-only. Default: false. */ readonly?: boolean; } /** * Open a SQLite connection and bring the schema up to the latest version. * Path may be `:memory:` for ephemeral test databases. */ export declare function openDatabase(path: string, options?: OpenDatabaseOptions): DatabaseInstance; /** * Helper for callers that want a promise-style "use DB then close" pattern. * The callback receives the open DB; the connection is closed afterwards * even on throw. Useful in tests and one-shot scripts. */ export declare function withDatabase(path: string, fn: (db: DatabaseInstance) => T, options?: OpenDatabaseOptions): T; export type { DatabaseInstance }; //# sourceMappingURL=db.d.ts.map