about summary refs log tree commit diff
path: root/web/converse/migrations/2018-05-01-183232_simplified-post-view/up.sql
diff options
context:
space:
mode:
Diffstat (limited to 'web/converse/migrations/2018-05-01-183232_simplified-post-view/up.sql')
-rw-r--r--web/converse/migrations/2018-05-01-183232_simplified-post-view/up.sql11
1 files changed, 11 insertions, 0 deletions
diff --git a/web/converse/migrations/2018-05-01-183232_simplified-post-view/up.sql b/web/converse/migrations/2018-05-01-183232_simplified-post-view/up.sql
new file mode 100644
index 0000000000..280fef8700
--- /dev/null
+++ b/web/converse/migrations/2018-05-01-183232_simplified-post-view/up.sql
@@ -0,0 +1,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;