A durable retrieval schema separates source identity, document versions, addressable chunks, permissions, and model-specific embeddings. This prevents one content update from destroying provenance, supports multiple embedding versions during migration, and makes deletion auditable. Put frequently filtered fields in typed columns; reserve JSON for truly variable metadata rather than hiding every business rule.
Sources represent external identity. Documents represent versioned normalized content. Chunks are stable citation and retrieval units. Embeddings are derived representations that can coexist by model.
Embeddings belong in a separate table when you need multiple models or asynchronous lifecycle. A single vector column on chunks is simpler for one stable model; make the tradeoff deliberately.
Use columns for tenant, state, language, dates, model ID, sensitivity, and other frequent filters or constraints. Use jsonb for provider-specific attributes that vary and are not core authorization. If a JSON key becomes a common predicate, promote it or create a carefully justified expression index.
Store source URI/key, document version, heading path, page or character range, and chunk checksum. A citation should resolve to the exact authorized version that supported the answer. Never cite a URL alone if its content can change silently.
Create a fixture with one source, two document versions, several chunks, and two embedding models. Prove both model versions can coexist. Delete only the second document inside a transaction and inspect cascades before rolling back. Use \d+ to review constraints and storage.
Normalize this proposed retrieval schema [paste] into sources, document versions, chunks, permissions, model registry, and embeddings. State lifecycle ownership and cascade behavior. Preserve stable citation coordinates. Use typed columns for frequent filters and explain each remaining JSON field.
Verification contract: Load a two-version fixture and test update, re-embedding, access revocation, and deletion without losing the ability to audit the prior state.