Tearleads

access_manifest_document_link_projection API Postgres table

Indexed document-to-container links committed by a document manifest.

Declared in packages/api-shared/src/schema/accessManifests.ts

Description

This is a derived cache. The signed document link-set manifest is the source of authority for document links; this projection lets services list documents in a container and resolve current blob/document KEK targets efficiently. Joined to accessManifestHeads on manifestHash, it is also the current document-to-container link set: there is no separate materialized copy, so structural guards (container deletion, sole-container purge, organization purge scope) read the same rows authorization does.

Indexes:

  • documentId supports document-oriented link queries.
  • (containerId, manifestHash, documentId) supports listing manifest-linked documents in a container.
  • (manifestHash, containerId) is unique because one manifest links a container at most once. It also serves loading the full link set for a manifest.

Columns

  • iduuid
    • primary key
    • not null
    • default gen_random_uuid()

    Surrogate database primary key.

  • manifest_hashtext
    • not null

    Document link-set access manifest whose linked-container set this row expands.

  • document_iduuid
    • not null

    Document described by the link-set manifest.

  • container_iduuid
    • not null

    Linked container id from the manifest state.

Indexes

  • access_manifest_document_link_document_idx(document_id)
    • access_manifest_document_link_container_manifest_idx(container_id, manifest_hash, document_id)
      • access_manifest_document_link_unique_idx(manifest_hash, container_id)
        • unique