principal_history_entries Client SQLite table
Entries are selected by their exact signed leaf, including signature bytes, or by state hash to supply a held head state to public history reads.
Declared in packages/client-sdk/src/data/sqlite/schema/principalHistoryEvidenceSchema.ts
Columns
scope_idtext- not null
Evidence scope the entry belongs to, as in
principal_history_prefixes.organization_idtext- not null
Organization of the evidence scope.
leaf_hashtext- not null
identity_bundle_formatinteger- not null
- default 1
Format of the principal identity data in this row. Always
1; restoring a backup row with any other value is refused.entry_jsontext- not null
JSON of the signed state chain entry as served:
state,projection, andgrants. The state-hash index reads$.state.stateHash.
Keys and constraints
- Primary key
(scope_id, leaf_hash)
Indexes
principal_history_entries_organization_idx(organization_id)principal_history_entries_state_hash_idx(json_extract(CASE WHEN json_valid("entry_json") THEN "entry_json" END, '$.state.stateHash'))
DDL
The statements the client runs to create this table and its indexes.
CREATE TABLE IF NOT EXISTS "principal_history_entries" (
"scope_id" TEXT NOT NULL,
"organization_id" TEXT NOT NULL,
"leaf_hash" TEXT NOT NULL,
"identity_bundle_format" INTEGER NOT NULL DEFAULT 1,
"entry_json" TEXT NOT NULL,
PRIMARY KEY ("scope_id", "leaf_hash")
);
CREATE INDEX IF NOT EXISTS "principal_history_entries_organization_idx" ON "principal_history_entries" ("organization_id");
CREATE INDEX IF NOT EXISTS "principal_history_entries_state_hash_idx" ON "principal_history_entries" (json_extract(CASE WHEN json_valid("entry_json") THEN "entry_json" END, '$.state.stateHash'));