Tearleads

container_document_sync_tombstones API Postgres table

Per-container document unlink tombstones for differential document discovery.

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

Description

A row means the document is no longer currently linked to the container as of updatedAt. If the document is linked again later, the current document row will carry a newer sync timestamp and wins in client application order.

Columns

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

    Surrogate database primary key.

  • container_iduuid
    • not null

    Container whose document lane lists the removal.

  • document_iduuid
    • not null

    Document unlinked from the container or purged.

  • discovery_orderbigint
    • not null
    • default 0

    Publication position stamped as the removal commits, from the counter documents and containers share. The container's document lane pages tombstones in (discoveryOrder, documentId) order.

  • updated_attimestamp
    • not null
    • default now()

    Server-side timestamp of the latest unlink or purge for this container and document. Rewriting it publishes the row again.

Indexes

  • container_document_sync_tombstones_unique_idx(container_id, document_id)
    • unique
  • document_tombstones_container_discovery_idx(container_id, discovery_order, document_id)