tirocinio-canali-steffo-acrate/acrate_database/migrations/2024-11-18-160501_meta_subject-null/down.sql

11 lines
322 B
MySQL
Raw Permalink Normal View History

UPDATE meta_subjects SET subject = 'invalid:subject.null' WHERE subject IS NULL;
ALTER TABLE meta_subjects ALTER subject SET NOT NULL;
ALTER TABLE meta_subjects ADD CONSTRAINT either_subject_or_redirect_not_null
CHECK (
(subject IS NOT NULL AND redirect IS NULL)
OR
(subject IS NULL AND redirect IS NOT NULL)
);