organization_data_usage_snapshots Client SQLite table
One server-computed usage snapshot per organization requester. The per-category document breakdown is the response's own array, stored as JSON in canonical category order in categoryBreakdownJson and re-validated against the response schema on every read; a row that fails is purged.
Declared in packages/client-sdk/src/data/sqlite/schema/organizationDataUsageSchema.ts
Columns
organization_idtext- not null
Organization the usage figures describe.
requester_user_idtext- not null
Local user whose usage request returned this snapshot.
projection_versioninteger- not null
Snapshot layout version,
ORGANIZATION_DATA_USAGE_PROJECTION_VERSIONwhen written. A row with any other value is purged on read.blob_countinteger- not null
Number of distinct blobs stored for the organization.
blob_byte_lengthinteger- not null
Total byte length of those blobs' encrypted objects.
document_byte_lengthinteger- not null
Total byte length of the organization's stored document updates.
document_countinteger- not null
Number of distinct documents with stored updates.
document_update_countinteger- not null
Number of stored document updates across those documents.
total_byte_lengthinteger- not null
documentByteLengthplusblobByteLength.category_breakdown_jsontext- not null
JSON array with one
{ byteLength, category, documentCount, updateCount }entry per document category (containerMetadata,rosterProfiles,organizationMetadata,user), in that order. The entries sum to the document totals.refreshed_attext- not null
ISO-8601 time this device stored the snapshot.
Keys and constraints
- Primary key
(organization_id, requester_user_id)
DDL
The statements the client runs to create this table and its indexes.
CREATE TABLE IF NOT EXISTS "organization_data_usage_snapshots" (
"organization_id" TEXT NOT NULL,
"requester_user_id" TEXT NOT NULL,
"projection_version" INTEGER NOT NULL,
"blob_count" INTEGER NOT NULL,
"blob_byte_length" INTEGER NOT NULL,
"document_byte_length" INTEGER NOT NULL,
"document_count" INTEGER NOT NULL,
"document_update_count" INTEGER NOT NULL,
"total_byte_length" INTEGER NOT NULL,
"category_breakdown_json" TEXT NOT NULL,
"refreshed_at" TEXT NOT NULL,
PRIMARY KEY ("organization_id", "requester_user_id")
);