/**
 * Fact + memo PG schema.
 *
 * Three tables:
 *
 * - `fact` — content-addressed bytes. `hash = 'blake3:<hex64>'`. Either
 *   embedded (`bytes`) or referenced (`external_url`); the CHECK constraint
 *   enforces exactly one populated. Idempotent: same bytes always produce
 *   the same hash, so `INSERT … ON CONFLICT DO NOTHING` is the put primitive.
 * - `fact_ref` — declared dependency edges (source fact → target fact).
 *   `target_hash` is intentionally **not** a foreign key: in federation a
 *   reference may target a fact stored on another instance.
 * - `memo` — `(fn_id, input_hash) → output_hash` for memoized computations.
 *
 * @module
 */
import type { Migration, MigrationNamespace } from './migrate.js';
/** `fact` table — content-addressed byte store. */
export declare const FACTS_SCHEMA = "\nCREATE TABLE IF NOT EXISTS fact (\n\thash TEXT PRIMARY KEY,\n\tbytes BYTEA,\n\texternal_url TEXT,\n\tcontent_type TEXT,\n\tsize BIGINT NOT NULL,\n\tcreated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n\tCONSTRAINT fact_storage_present CHECK (bytes IS NOT NULL OR external_url IS NOT NULL)\n)";
/**
 * `fact_ref` table — declared dependency edges between facts.
 *
 * `target_hash` is not a foreign key (federation: target may live remotely).
 */
export declare const FACT_REFS_SCHEMA = "\nCREATE TABLE IF NOT EXISTS fact_ref (\n\tsource_hash TEXT NOT NULL REFERENCES fact(hash) ON DELETE CASCADE,\n\ttarget_hash TEXT NOT NULL,\n\tPRIMARY KEY (source_hash, target_hash)\n)";
/** Reverse lookup: which facts reference a given target? */
export declare const FACT_REFS_TARGET_INDEX = "\nCREATE INDEX IF NOT EXISTS idx_fact_ref_target ON fact_ref(target_hash)";
/** `memo` table — `(fn_id, input_hash) → output_hash` for memoized computations. */
export declare const MEMOS_SCHEMA = "\nCREATE TABLE IF NOT EXISTS memo (\n\tfn_id TEXT NOT NULL,\n\tinput_hash TEXT NOT NULL,\n\toutput_hash TEXT NOT NULL,\n\tcreated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),\n\tPRIMARY KEY (fn_id, input_hash)\n)";
/** Tables created by `FACT_MIGRATION_NS`, in drop order (children first). */
export declare const FACT_DROP_TABLES: readonly ["memo", "fact_ref", "fact"];
/** Fact + memo migrations. */
export declare const FACT_MIGRATIONS: Array<Migration>;
/** Namespace identifier for fact + memo migrations. */
export declare const FACT_MIGRATION_NAMESPACE = "fuz_facts";
/** Migration namespace consumed by `run_migrations`. */
export declare const FACT_MIGRATION_NS: MigrationNamespace;
//# sourceMappingURL=fact_ddl.d.ts.map