documents API Postgres table
One row per server document: the anchor of its encrypted Loro history in document_updates and the counters listings read without scanning it. The server stores only ciphertext and signed metadata; it never decrypts a document.
Declared in packages/loro/src/server/schema.ts
Columns
iduuid- primary key
- not null
- default gen_random_uuid()
Document id.
attribution_revisioninteger- not null
- default 0
Advances with every accepted update (through the
count_document_updatestrigger). Edit-attributionETags and range cursors carry it, so a page read across a new write fails instead of mixing histories.attribution_incarnationuuid- not null
- default gen_random_uuid()
Random at creation. Edit-attribution responses and cursors carry it as the document incarnation.
created_by_fingerprinttext- not null
Signing-key fingerprint of the session that created the document.
created_attimestamp- not null
- default now()
Server-side creation timestamp.
discovery_orderbigint- not null
- default 0
Publication position stamped when a change to the document commits; discovery listings page in this order.
update_countinteger- not null
- default 0
How many
document_updatesrows the document holds, kept by thecount_document_updatestrigger in the inserting transaction, so a listing reads it without scanning the document's history.updated_attimestamp- not null
- default now()
Last change, stamped by every accepted update.
Indexes
documents_discovery_idx(discovery_order, id)documents_updated_at_id_idx(updated_at, id)