blob: b415d5b898ae1aa84c972e9ef618159932821bef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
ALTER TABLE lazychat_targets RENAME TO post_targets;
CREATE VIEW user_visible_posts AS
SELECT eur.user, t.message
FROM effective_user_roles eur, post_targets t
WHERE t.target = eur.role
UNION
SELECT m.owner, m.message
FROM posts m;
CREATE OR REPLACE VIEW user_visible_lazychat_messages AS
SELECT uvp.user, uvp.message
FROM user_visible_posts uvp
INNER JOIN lazychat_messages lm ON lm.id = uvp.message;
|