about summary refs log tree commit diff
path: root/src/schema.rs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-05-01T18·49+0200
committerVincent Ambo <github@tazj.in>2018-05-01T22·33+0200
commit9b1f6d3628884059753169f4dd6e018bab74c40f (patch)
tree5d608b4fa35cc935a7372985d211e2f9835ff2b5 /src/schema.rs
parent9d5830e9a724d04b2f6fd410c7ae2b56ceea576f (diff)
refactor(db/render/schema): Use SimplePost type for thread views
This uses the simplified view for querying posts instead of the post
table directly to display posts.
Diffstat (limited to 'src/schema.rs')
-rw-r--r--src/schema.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/schema.rs b/src/schema.rs
index c9ca615e6e10..a824c658c00f 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -47,7 +47,20 @@ table! {
 
 // Note: Manually inserted as print-schema does not add views.
 table! {
-    thread_index (thread_id){
+    simple_posts (id) {
+        id -> Int4,
+        thread_id -> Int4,
+        body -> Text,
+        posted -> Timestamptz,
+        user_id -> Int4,
+        author_name -> Text,
+        author_email -> Text,
+    }
+}
+
+// Note: Manually inserted as print-schema does not add views.
+table! {
+    thread_index (thread_id) {
         thread_id -> Int4,
         title -> Text,
         thread_author -> Text,
@@ -62,9 +75,11 @@ table! {
 joinable!(posts -> threads (thread_id));
 joinable!(posts -> users (user_id));
 joinable!(threads -> users (user_id));
+joinable!(simple_posts -> threads (thread_id));
 
 allow_tables_to_appear_in_same_query!(
     posts,
     threads,
     users,
+    simple_posts,
 );