payloads
Raw vendor responses, a purgeable cache tier (ADR-030)
What you'll learn
You're writing SQL that reads payloads and need its columns, what each holds, and the DDL as the spec states it.
- every column and its type
- what the object holds and who writes it
- the DDL as the spec states it
A table. Raw vendor responses, a purgeable cache tier (ADR-030) — never facts.
Columns
| Column | Type | Constraints |
|---|---|---|
id | TEXT | PRIMARY KEY |
identity_id | TEXT | NOT NULL REFERENCES identities(id) |
adapter | TEXT | NOT NULL |
run_id | TEXT | |
content_type | TEXT | |
body | TEXT | NOT NULL |
created_at | TEXT | NOT NULL |
expires_at | TEXT |
Definition
From spec/ledger.sql, which is the machine-checkable form of SPEC.md §3:
CREATE TABLE payloads (
id TEXT PRIMARY KEY, -- ULID
identity_id TEXT NOT NULL REFERENCES identities(id),
adapter TEXT NOT NULL, -- adapter id that fetched it
run_id TEXT,
content_type TEXT, -- e.g. application/json, text/markdown
body TEXT NOT NULL,
created_at TEXT NOT NULL,
expires_at TEXT
);
CREATE INDEX ix_payloads_lookup ON payloads(identity_id, adapter, created_at DESC);
CREATE INDEX ix_payloads_expiry ON payloads(expires_at);