Реализовать версии pipeline, fencing и автоматические сценарии отказов

This commit is contained in:
2026-11-20 06:51:54 +03:00
parent e376ede0a2
commit 42bf6aa702
21 changed files with 845 additions and 53 deletions
+19
View File
@@ -0,0 +1,19 @@
ALTER TABLE attachments
ADD COLUMN target_pipeline_version integer NOT NULL DEFAULT 1 CHECK (target_pipeline_version >= 1),
ADD COLUMN published_pipeline_version integer CHECK (published_pipeline_version >= 1),
ADD CHECK (published_pipeline_version <= target_pipeline_version);
UPDATE attachments SET published_pipeline_version = 1 WHERE state = 'ready';
ALTER TABLE attachment_jobs
DROP CONSTRAINT attachment_jobs_attachment_id_key,
DROP CONSTRAINT attachment_jobs_staging_key_key,
DROP CONSTRAINT attachment_jobs_state_check,
ADD COLUMN pipeline_version integer NOT NULL DEFAULT 1 CHECK (pipeline_version >= 1),
ADD COLUMN settled_at timestamptz,
ADD CHECK (state IN ('queued', 'processing', 'ready', 'failed', 'superseded')),
ADD UNIQUE (attachment_id, pipeline_version);
CREATE INDEX attachment_jobs_staging ON attachment_jobs(staging_key);
ALTER TABLE attachment_variants ADD COLUMN pipeline_version integer NOT NULL DEFAULT 1;
ALTER TABLE attachment_variants DROP CONSTRAINT attachment_variants_pkey;
ALTER TABLE attachment_variants ADD PRIMARY KEY (attachment_id, pipeline_version, name);