1 DROP MATERIALIZED VIEW private_message_mview;
3 DROP VIEW private_message_view;
5 ALTER TABLE private_message
9 CREATE VIEW private_message_view AS
12 u.name AS creator_name,
13 u.avatar AS creator_avatar,
14 u2.name AS recipient_name,
15 u2.avatar AS recipient_avatar
18 INNER JOIN user_ u ON u.id = pm.creator_id
19 INNER JOIN user_ u2 ON u2.id = pm.recipient_id;
21 CREATE MATERIALIZED VIEW private_message_mview AS
27 CREATE UNIQUE INDEX idx_private_message_mview_id ON private_message_mview (id);