about summary refs log tree commit diff
path: root/web/converse/migrations/2018-05-01-183232_simplified-post-view/up.sql
blob: 280fef87003ee91a280b3f765d7e918b3179cf5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
-- Creates a view for listing posts akin to the post table before
-- splitting out users. This exists to avoid having to do joining
-- logic and such inside of the application.

CREATE VIEW simple_posts AS
  SELECT p.id AS id,
         thread_id, body, posted, user_id,
         users.name AS author_name,
         users.email AS author_email
  FROM posts p
  JOIN users ON users.id = p.user_id;