mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-08 19:21:41 +00:00
Fixing column XOR check.
This commit is contained in:
parent
1776de2f45
commit
612c2e916f
1 changed files with 2 additions and 1 deletions
|
@ -14,7 +14,8 @@ CREATE TABLE report_combined (
|
|||
post_report_id int REFERENCES post_report ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
comment_report_id int REFERENCES comment_report ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
private_message_report_id int REFERENCES private_message_report ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
UNIQUE (post_report_id, comment_report_id, private_message_report_id)
|
||||
-- Make sure only one of the columns is not null
|
||||
CHECK ((post_report_id IS NOT NULL)::integer + (comment_report_id IS NOT NULL)::integer + (private_message_report_id IS NOT NULL)::integer = 1)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_report_combined_published ON report_combined (published DESC, id DESC);
|
||||
|
|
Loading…
Reference in a new issue