Tearleads

Postgres schema reference

Every table the API keeps in Postgres, with its columns, keys, indexes, and what each holds.

58 tables, as of migration 0028_operator_organization. docs/database/postgres.json

The API's tables in Postgres (PlanetScale in production, PGlite or Postgres in tests), defined with Drizzle in packages/api-shared/src/schema. They change only through the append-only migrations in packages/api-shared/drizzle; API persistence describes the adapters and the rules each migration follows.

Document and blob bytes reach the server already encrypted. The tables hold that ciphertext, the signed metadata the server verifies, and the access state it enforces; blob bytes live in the object store, which these rows name by storage key.

Access events

packages/api-shared/src/schema/accessEvents.ts

Access manifests

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

Blob audit objects

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

Blob content keys

packages/api-shared/src/schema/blobContentKeys.ts

Blobs

packages/api-shared/src/schema/blobs.ts

Container keying

packages/api-shared/src/schema/containerKeying.ts

Containers

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

Document content keys

packages/api-shared/src/schema/documentContentKeys.ts

Document inline rekey commits

packages/api-shared/src/schema/documentInlineRekeyCommits.ts

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

Document peer owners

packages/api-shared/src/schema/documentPeerOwners.ts

Documents and updates

packages/loro/src/server/schema.ts

Groups

packages/api-shared/src/schema/groups.ts

Job runs

packages/api-shared/src/schema/jobRuns.ts

Operator organization

packages/api-shared/src/schema/operatorOrganization.ts

Organization billing invoice events

packages/api-shared/src/schema/organizationBillingInvoiceEvents.ts

Organization billing lifecycle events

packages/api-shared/src/schema/organizationBillingLifecycleEvents.ts

Organization billing seats

packages/api-shared/src/schema/organizationBillingSeats.ts

Organization read models

packages/api-shared/src/schema/organizationReadModels.ts

Organizations

packages/api-shared/src/schema/organizations.ts

Principal directory bindings

packages/api-shared/src/schema/principalDirectoryBindings.ts

Principal history index nodes

packages/api-shared/src/schema/principalHistoryIndexNodes.ts

Principal history progress

packages/api-shared/src/schema/principalHistoryProgress.ts

Principal policy commits

packages/api-shared/src/schema/principalPolicyCommits.ts

Principal policy mutation acknowledgements

packages/api-shared/src/schema/principalPolicyMutationAcknowledgements.ts

Principal states

packages/api-shared/src/schema/principalStates.ts

Purged object reservations

packages/api-shared/src/schema/purgedObjectReservations.ts

RevenueCat webhook events

packages/api-shared/src/schema/revenuecatWebhookEvents.ts

Root audit events

packages/api-shared/src/schema/rootAuditEvents.ts

Two factor

packages/api-shared/src/schema/twoFactor.ts

User device states

packages/api-shared/src/schema/userDeviceStates.ts

Users

packages/api-shared/src/schema/users.ts