Реализовать лабораторную 7

This commit is contained in:
Krep4334
2026-12-01 17:47:59 +03:00
parent 20afc2c790
commit 9ffa60daef
89 changed files with 5054 additions and 69 deletions
+19
View File
@@ -0,0 +1,19 @@
ALTER TABLE attachments ADD COLUMN status text NOT NULL DEFAULT 'receiving'
CHECK (status IN ('receiving','queued','processing','ready','failed'));
UPDATE attachments SET status='ready' WHERE ready;
ALTER TABLE attachments ADD COLUMN variants jsonb NOT NULL DEFAULT '[]';
ALTER TABLE attachments ADD COLUMN error_code text;
CREATE TABLE jobs (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
attachment_id uuid NOT NULL UNIQUE REFERENCES attachments(id),
attempt integer NOT NULL DEFAULT 0,
next_attempt timestamptz NOT NULL DEFAULT now(),
published_at timestamptz,
lease_until timestamptz,
finished boolean NOT NULL DEFAULT false
);
CREATE TABLE job_replays (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
job_id uuid NOT NULL REFERENCES jobs(id),
replayed_at timestamptz NOT NULL DEFAULT now()
);