Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
-- Phase 06 / F-003 — Per-tenant hash chain on PluginCapabilityUse.
|
||||
--
|
||||
-- Adds two nullable columns:
|
||||
-- prevHash : `rowHash` of the previous row in this tenant's chain
|
||||
-- (or NULL for the genesis row).
|
||||
-- rowHash : SHA-256(prevHash || canonical(row)) — computed by the
|
||||
-- worker handler before insert.
|
||||
--
|
||||
-- A verifier can walk the chain ordered by (tenantId, timestamp ASC) and
|
||||
-- detect any tampered or deleted row by recomputing the hash and
|
||||
-- comparing. Nullable for back-compat: pre-F-003 rows have NULL hashes;
|
||||
-- the verifier reports such rows as "pre-chain" rather than treating
|
||||
-- them as integrity failures.
|
||||
|
||||
ALTER TABLE "PluginCapabilityUse"
|
||||
ADD COLUMN "prevHash" TEXT,
|
||||
ADD COLUMN "rowHash" TEXT;
|
||||
|
||||
-- Index that lets the worker fetch the most recent rowHash per tenant
|
||||
-- in a single read (used to seed the chain on the next batch). The
|
||||
-- existing (tenantId, timestamp DESC) covers the leading edge; this
|
||||
-- partial index limits to non-null rowHash so a tenant with mixed
|
||||
-- pre/post F-003 rows resolves the chain head quickly.
|
||||
CREATE INDEX "PluginCapabilityUse_tenantId_chainHead_idx"
|
||||
ON "PluginCapabilityUse" ("tenantId", "timestamp" DESC)
|
||||
WHERE "rowHash" IS NOT NULL;
|
||||
Reference in new issue
Block a user