CREATE VIEW api.comment AS
	SELECT
		c.id,
		c.user_id,
		c.post_id,
		c.content,
		c.created,
		c.modified
	FROM
		admin.comment c
	LEFT JOIN
		admin.post p
	ON
		p.id = c.post_id
	LEFT JOIN
		admin.user u
	ON
		u.id = c.user_id
	WHERE
		c.deleted <> TRUE AND
		p.deleted <> TRUE AND
		u.deleted <> TRUE
	ORDER BY
		id ASC;

GRANT SELECT ON TABLE api.comment
	TO rest_anon, rest_user;
GRANT SELECT ON TABLE admin.comment
	TO rest_anon, rest_user;
