Centralize durable schema migration ownership

This commit is contained in:
ms2k 2026-07-19 01:20:18 +09:00
commit 069f3813ae

View file

@ -0,0 +1,14 @@
CREATE TABLE worker_descriptors (
descriptor_id TEXT PRIMARY KEY,
attempt_id TEXT NOT NULL REFERENCES attempts (attempt_id) ON DELETE CASCADE,
kind TEXT NOT NULL CHECK (kind IN ('resolved_source', 'checkpoint')),
schema_version INTEGER NOT NULL CHECK (schema_version >= 1),
payload JSONB NOT NULL,
byte_length BIGINT NOT NULL CHECK (byte_length >= 0),
item_count BIGINT CHECK (item_count >= 0),
checksum TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL
);
CREATE INDEX worker_descriptors_attempt_idx
ON worker_descriptors (attempt_id, kind, created_at, descriptor_id);