Files
mtusi2026lab7/migrations/006_attachment_jobs.sql
T
Khakimov Dmitrij 2a7418fc45
Skeleton contracts / contracts (pull_request) Blocked by required conditions
lab 7 done
2026-11-29 21:59:16 +03:00

19 lines
706 B
SQL

-- +goose Up
CREATE TABLE attachment_jobs (
id uuid PRIMARY KEY,
attachment_id uuid NOT NULL UNIQUE REFERENCES attachments(id),
pipeline_version integer NOT NULL DEFAULT 1,
state text NOT NULL CHECK (state IN ('queued','processing','ready','failed')),
attempts integer NOT NULL DEFAULT 0,
max_attempts integer NOT NULL CHECK (max_attempts BETWEEN 1 AND 20),
available_at timestamptz NOT NULL DEFAULT clock_timestamp(),
lease_until timestamptz,
fence bigint NOT NULL DEFAULT 0,
last_error text,
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
updated_at timestamptz NOT NULL DEFAULT clock_timestamp()
);
-- +goose Down
DROP TABLE attachment_jobs;