Tearleads

blob_audit_objects API Postgres table

Registry of every blob generation an attachment binding has referenced.

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

Description

Attachment bind, replace, and detach register each referenced blob here before live blob pruning can remove its row. The registry outlives the live blobs row: it pins the owning organization, records immutable content metadata, and carries the physical-deletion work item (the storage key while deletion is pending) plus pruning/deletion timestamps. Blob GC, blob authorization, and organization purge read it.

Columns

  • blob_iduuid
    • primary key
    • not null

    Primary key matching the committed blob id.

  • organization_iduuid
    • not null

    Organization that owns this blob generation. Retained after pruning so historical ids cannot become cross-organization probes.

  • sha256text
    • not null

    SHA-256 digest of the encrypted blob bytes.

  • byte_lengthinteger
    • not null

    Byte length of the encrypted blob bytes.

  • live_storage_keytext
    • nullable

    Storage key for the live blob object when available.

  • retention_modetext
    • not null

    Retention policy for the registered blob metadata. Currently only live_only is supported.

  • historical_bytes_retainedboolean
    • not null

    Whether historical encrypted bytes are retained outside the live blob object.

  • pruned_attimestamp
    • nullable

    Timestamp when live database state was pruned and physical object deletion became pending.

  • object_delete_attempted_attimestamp
    • nullable

    Timestamp of the most recent physical deletion attempt. Pending batches reserve capacity for both new items and retries; failed items rotate by this timestamp instead of starving the queue.

  • object_deleted_attimestamp
    • nullable

    Timestamp when object-store deletion completed. While this is null on a pruned row, liveStorageKey is the durable deletion work item retried by blob maintenance.

  • created_attimestamp
    • not null
    • default now()

    Server-side insertion timestamp.

Indexes

  • blob_audit_objects_organization_idx(organization_id)
    • blob_audit_objects_pending_delete_idx(object_delete_attempted_at, pruned_at, blob_id)
      • partial: where "pruned_at" is not null and "object_deleted_at" is null and "live_storage_key" is not null