Centralize durable schema migration ownership
This commit is contained in:
parent
cc328237f4
commit
069f3813ae
1 changed files with 354 additions and 350 deletions
14
crates/remora-schema/migrations/worker/0001_descriptors.sql
Normal file
14
crates/remora-schema/migrations/worker/0001_descriptors.sql
Normal 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);
|
||||
Loading…
Reference in a new issue