Files
mtusi2026lab6/migrations/0005_allow_pending_deletion.sql
2026-11-01 14:46:14 +03:00

10 lines
282 B
SQL

ALTER TABLE attachments
DROP CONSTRAINT attachments_ready_at;
ALTER TABLE attachments
ADD CONSTRAINT attachments_ready_at CHECK (
(status = 'pending' AND ready_at IS NULL) OR
(status = 'ready' AND ready_at IS NOT NULL) OR
status = 'deleting'
);