Add 5 lab code

This commit is contained in:
2026-11-16 15:13:01 +03:00
parent 470d9d6f1e
commit 0497b0c217
46 changed files with 2196 additions and 16 deletions
+23
View File
@@ -0,0 +1,23 @@
ALTER TABLE attachments
ADD COLUMN updated_at timestamptz NOT NULL DEFAULT clock_timestamp(),
ADD COLUMN status text NOT NULL DEFAULT 'ready'
CHECK (status IN ('queued', 'processing', 'ready', 'failed')),
ADD COLUMN staging_key text,
ADD COLUMN variants jsonb NOT NULL DEFAULT '[]',
ADD COLUMN error_code text;
ALTER TABLE attachments ALTER COLUMN status SET DEFAULT 'queued';
CREATE TABLE attachment_jobs (
id uuid PRIMARY KEY,
attachment_id uuid NOT NULL UNIQUE REFERENCES attachments(id),
pipeline_version bigint NOT NULL DEFAULT 1 CHECK (pipeline_version = 1),
attempt bigint NOT NULL DEFAULT 0,
failures bigint NOT NULL DEFAULT 0,
available_at timestamptz NOT NULL DEFAULT now(),
published_at timestamptz,
lease_until timestamptz,
lease_token uuid,
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
replay_audit jsonb NOT NULL DEFAULT '[]'
);
CREATE INDEX attachment_jobs_due_idx ON attachment_jobs(available_at);