19 lines
706 B
SQL
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;
|