lab6 done

This commit is contained in:
Khakimov Dmitrij
2026-11-18 21:37:25 +03:00
parent 470d9d6f1e
commit 4ab9b0ef9a
158 changed files with 21115 additions and 52 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;