2 DROP VIEW user_view CASCADE;
5 ADD COLUMN fedi_name varchar(40) NOT NULL DEFAULT 'http://fake.com';
8 ADD CONSTRAINT user__name_fedi_name_key UNIQUE (name, fedi_name);
12 ADD CONSTRAINT community_name_key UNIQUE (name);
14 CREATE VIEW user_view AS
25 u.send_notifications_to_email,
33 p.creator_id = u.id) AS number_of_posts,
36 coalesce(sum(score), 0)
42 AND p.id = pl.post_id) AS post_score,
49 c.creator_id = u.id) AS number_of_comments,
52 coalesce(sum(score), 0)
58 AND c.id = cl.comment_id) AS comment_score
62 CREATE MATERIALIZED VIEW user_mview AS
68 CREATE UNIQUE INDEX idx_user_mview_id ON user_mview (id);