forked from mtusi2026/mtusi2026lab7
на оценку 4
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
BEGIN;
|
||||
|
||||
DROP TABLE IF EXISTS attachment_jobs;
|
||||
DROP TABLE IF EXISTS attachment_variants;
|
||||
|
||||
ALTER TABLE attachments
|
||||
DROP CONSTRAINT attachments_status_supported,
|
||||
DROP CONSTRAINT attachments_status_error_consistency,
|
||||
DROP CONSTRAINT attachments_staging_key_not_blank,
|
||||
DROP CONSTRAINT attachments_staging_key_unique,
|
||||
DROP CONSTRAINT attachments_pipeline_version_positive,
|
||||
DROP COLUMN pipeline_version,
|
||||
DROP COLUMN staging_key;
|
||||
|
||||
UPDATE attachments SET status = 'pending' WHERE status IN ('queued', 'processing');
|
||||
|
||||
ALTER TABLE attachments
|
||||
ADD CONSTRAINT attachments_status_supported CHECK (status IN ('pending', 'ready', 'failed')),
|
||||
ADD CONSTRAINT attachments_status_error_consistency CHECK (
|
||||
(status = 'failed' AND error_code IS NOT NULL AND btrim(error_code) <> '')
|
||||
OR (status IN ('pending', 'ready') AND error_code IS NULL)
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
|
||||
Reference in New Issue
Block a user