lemmy/migrations/2024-12-27-220142_community_report/down.sql
dullbananas 4d17eef82b
Add community reports (only the database part) (#4996)
* database stuff, not including tests

* change migration date

* fix community_report_view

* update stuff related to report_combined

* add db_schema/src/impls/community_report.rs

* add report counts to community_aggregates

* fix community_report columns and update report_combined_view::tests::test_combined

* add column for original sidebar; use None instead of clone; add report_combined_view::tests::test_community_reports

* use ts(optional) in CommunityReportView

* remove CommunityReportView::read
2025-01-13 05:14:56 -05:00

14 lines
417 B
SQL

DELETE FROM report_combined
WHERE community_report_id IS NOT NULL;
ALTER TABLE report_combined
DROP CONSTRAINT report_combined_check,
ADD CHECK (num_nonnulls (post_report_id, comment_report_id, private_message_report_id) = 1),
DROP COLUMN community_report_id;
DROP TABLE community_report CASCADE;
ALTER TABLE community_aggregates
DROP COLUMN report_count,
DROP COLUMN unresolved_report_count;