Tearleads

container_sync_tombstones API Postgres table

Per-user tombstones for containers that should be removed from a local sync view. This is intentionally scoped to a user because removals caused by access changes are visibility decisions, not global object deletion facts.

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

Description

The parent-lane index mirrors the live container scan so a client can request tombstones for the same parent container watermark it uses for live rows. A separate root-discovery marker covers directly granted non-root containers, which are discoverable from root even though their stored parentId is the real parent lane.

Columns

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

    Surrogate database primary key.

  • user_iduuid
    • not null

    User whose sync view drops the container.

  • organization_iduuid
    • not null

    Organization of the container. Organization purge and regained-access pruning filter on it.

  • container_iduuid
    • not null

    Container removed from the user's view.

  • parent_iduuid
    • nullable

    Parent lane that lists the removal: the container's parent when the removal was recorded (its old parent for a move), or null for a root.

  • depthinteger
    • not null

    The container's depth in that position, as in containers.depth.

  • reasontext
    • not null

    Why the container left the view: deleted or access_revoked.

  • root_discovery_visibleboolean
    • not null
    • default false

    Whether the user's root discovery lane also lists the removal, for a container the user could discover from root through a grant on it. A later removal of the same container never clears it.

  • discovery_orderbigint
    • not null
    • default 0

    Publication position stamped as the removal commits, from the counter containers uses. Lanes page tombstones in (discoveryOrder, containerId) order.

  • updated_attimestamp
    • not null
    • default now()

    Server-side timestamp of the latest removal for this user and container. Rewriting it publishes the row again.

Indexes

  • container_sync_tombstones_user_container_idx(user_id, container_id)
    • unique
  • container_tombstones_user_parent_discovery_idx(user_id, parent_id, discovery_order, container_id)
    • container_tombstones_user_root_discovery_idx(user_id, root_discovery_visible, discovery_order, container_id)
      • container_sync_tombstones_organization_idx(organization_id)