--- status: accepted date: 2026-08-26 --- # Use PostgreSQL as the metadata catalog ThothII uses an internal PostgreSQL Metadata Catalog to store, for each workspace, the physical structure obtained by introspecting its database and the AI-generated semantic metadata. Each Workspace Database carries a mandatory, unique `workspace_id`, which enforces the one-to-one association without a Workspace table or SQL foreign key; workspace identity and the workspace list stay authoritative in the workspace descriptors, and the service validates references against them. The catalog's administrative interface and lifecycle stay separate from the NL→SQL workflow. ## Considered Options - Keeping `annotations.yaml` as the source of truth would have kept Git versioning, but not the required CRUD and introspection/generation process. - Reading mutable metadata from the catalog without an explicit boundary would have coupled the workflow to the availability of the new service and allowed partial views during updates. ## Consequences Replacing `schema/annotations.yaml` as the core input is a later, explicit cutover (ADR-0040). PostgreSQL guarantees that one `workspace_id` is not assigned to two databases, but workspace existence, renames and removals remain the responsibility of the application boundary with the workspace descriptors.