lazyBoy/migrations/034_recovery_provenance.sql

19 lines
958 B
MySQL
Raw Permalink Normal View History

2026-09-11 02:47:43 +00:00
-- Only an acknowledged provider destroy may create retirement evidence.
-- A changed PID namespace, provider name or generation is not sufficient.
CREATE TABLE computer_generation_retirements (
computer_id TEXT NOT NULL REFERENCES computers(id) ON DELETE CASCADE,
generation INTEGER NOT NULL CHECK(generation > 0),
provider_ref TEXT NOT NULL,
home_key TEXT NOT NULL,
proof_id TEXT NOT NULL UNIQUE,
proof_kind TEXT NOT NULL CHECK(proof_kind = 'provider_destroy_ack'),
acknowledged_at TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp(),
PRIMARY KEY(computer_id,generation)
);
-- Historical artifact rows did not record their verification source; do not
-- retroactively label them as execution receipts without trusted evidence.
ALTER TABLE computer_artifacts ADD COLUMN verification_basis TEXT NOT NULL
DEFAULT 'legacy_unspecified'
CHECK(verification_basis IN ('legacy_unspecified','execution_receipt','postcondition'));