lab5 done

This commit is contained in:
Khakimov Dmitrij
2026-11-10 22:13:40 +03:00
parent b2bd7501d3
commit cbe9d8748c
63 changed files with 8907 additions and 307 deletions
+18
View File
@@ -0,0 +1,18 @@
-- +goose Up
ALTER TABLE attachments
DROP CONSTRAINT attachments_status_check,
ADD CONSTRAINT attachments_status_check CHECK (status IN ('queued','processing','ready','failed')),
DROP CONSTRAINT attachments_check,
ADD CONSTRAINT attachments_check CHECK ((status='failed' AND error_code IS NOT NULL) OR (status<>'failed' AND error_code IS NULL)),
ADD COLUMN variants jsonb NOT NULL DEFAULT '[]',
ADD COLUMN updated_at timestamptz NOT NULL DEFAULT clock_timestamp(),
ADD COLUMN pipeline_version integer NOT NULL DEFAULT 1,
ADD COLUMN staging_key text;
-- +goose Down
UPDATE attachments SET status='failed',error_code='pipeline_downgrade' WHERE status IN ('queued','processing');
ALTER TABLE attachments DROP CONSTRAINT attachments_status_check,
ADD CONSTRAINT attachments_status_check CHECK (status IN ('ready','failed')),
DROP CONSTRAINT attachments_check,
ADD CONSTRAINT attachments_check CHECK ((status='ready' AND error_code IS NULL) OR (status='failed' AND error_code IS NOT NULL)),
DROP COLUMN variants, DROP COLUMN updated_at, DROP COLUMN pipeline_version, DROP COLUMN staging_key;