pgapi-multi-tenant-composite-keys

IN premise

All PgApi tables use composite primary keys `(id, project_id)` for multi-tenancy, with JSONB columns (not TEXT) for antecedents, outlist, and metadata

Summary

Every table in the PgApi storage layer identifies rows by a combination of the record's own ID and a project ID, which keeps different tenants' data isolated at the database level. The structured columns like antecedents and metadata are stored as JSONB rather than plain text, meaning Postgres can natively query and index their contents without requiring serialization or deserialization in application code.

Dependents

These beliefs depend on this one:

Details

Sourceentries/2026/04/28/reasons_lib-pg.md