diff options
author | Vincent Ambo <tazjin@gmail.com> | 2018-04-14T15·15+0200 |
---|---|---|
committer | Vincent Ambo <tazjin@gmail.com> | 2018-04-14T15·15+0200 |
commit | f10bd20276dc1271b3a17197adf53a014c5979b1 (patch) | |
tree | 41851be75309e6395dc1f2d6f11aad4255313833 /src/schema.rs | |
parent | cf64826e4eda1ee7839a9a3e9b114564b3cced92 (diff) |
feat(db): Add view for ordering thread index by most recent post
This implements the classic thread ordering expected by most forum users (i.e. the thread with the most recent post is at the top).
Diffstat (limited to 'src/schema.rs')
-rw-r--r-- | src/schema.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/schema.rs b/src/schema.rs index d14c89c4c7f8..02392c8fc60c 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -19,6 +19,17 @@ table! { } } +// Note: Manually inserted as print-schema does not add views. +table! { + thread_index (thread_id){ + thread_id -> Integer, + title -> Text, + author_name -> Text, + posted -> Timestamptz, + post_id -> Integer, + } +} + joinable!(posts -> threads (thread_id)); allow_tables_to_appear_in_same_query!( |