15 lines
639 B
SQL
15 lines
639 B
SQL
CREATE TABLE assessor_artifact_deletion_outbox (
|
|
id text PRIMARY KEY CHECK (btrim(id) <> ''),
|
|
project_id text NOT NULL CHECK (btrim(project_id) <> ''),
|
|
artifact_id text NOT NULL CHECK (btrim(artifact_id) <> ''),
|
|
storage_key text NOT NULL UNIQUE CHECK (btrim(storage_key) <> ''),
|
|
attempts integer NOT NULL DEFAULT 0 CHECK (attempts >= 0),
|
|
next_attempt_at timestamptz NOT NULL,
|
|
created_at timestamptz NOT NULL,
|
|
last_error_code text,
|
|
data jsonb NOT NULL CHECK (jsonb_typeof(data) = 'object')
|
|
);
|
|
|
|
CREATE INDEX assessor_artifact_deletion_outbox_due_idx
|
|
ON assessor_artifact_deletion_outbox(next_attempt_at, created_at, id);
|