2 DROP TRIGGER refresh_private_message ON private_message;
4 DROP FUNCTION refresh_private_message ();
6 -- Drop the view and table
7 DROP VIEW private_message_view CASCADE;
9 DROP TABLE private_message;
11 -- Rebuild the old views
12 DROP VIEW user_view CASCADE;
14 CREATE VIEW user_view AS
24 u.send_notifications_to_email,
32 p.creator_id = u.id) AS number_of_posts,
35 coalesce(sum(score), 0)
41 AND p.id = pl.post_id) AS post_score,
48 c.creator_id = u.id) AS number_of_comments,
51 coalesce(sum(score), 0)
57 AND c.id = cl.comment_id) AS comment_score
61 CREATE MATERIALIZED VIEW user_mview AS
67 CREATE UNIQUE INDEX idx_user_mview_id ON user_mview (id);
71 DROP COLUMN matrix_user_id;