9 lines
528 B
SQL
9 lines
528 B
SQL
CREATE TABLE IF NOT EXISTS dune_kit_deliveries (
|
|
id UUID PRIMARY KEY,
|
|
buyer_uuid UUID NOT NULL,
|
|
snapshot_json TEXT NOT NULL CHECK (octet_length(snapshot_json) <= 65536),
|
|
snapshot_hash CHAR(64) NOT NULL CHECK (snapshot_hash ~ '^[a-f0-9]{64}$'),
|
|
created_at BIGINT NOT NULL CHECK (created_at > 0),
|
|
delivered_at BIGINT NULL CHECK (delivered_at IS NULL OR delivered_at > 0)
|
|
);
|
|
CREATE INDEX IF NOT EXISTS dune_kit_deliveries_pending ON dune_kit_deliveries(buyer_uuid,created_at,id) WHERE delivered_at IS NULL;
|

Staff