]> Untitled Git - lemmy.git/blob - crates/db_schema/src/schema.rs
Add default post listing type (fixes #2195) (#2209)
[lemmy.git] / crates / db_schema / src / schema.rs
1 table! {
2     activity (id) {
3         id -> Int4,
4         data -> Jsonb,
5         local -> Bool,
6         published -> Timestamp,
7         updated -> Nullable<Timestamp>,
8         ap_id -> Text,
9         sensitive -> Nullable<Bool>,
10     }
11 }
12
13 table! {
14     comment (id) {
15         id -> Int4,
16         creator_id -> Int4,
17         post_id -> Int4,
18         parent_id -> Nullable<Int4>,
19         content -> Text,
20         removed -> Bool,
21         read -> Bool,
22         published -> Timestamp,
23         updated -> Nullable<Timestamp>,
24         deleted -> Bool,
25         ap_id -> Varchar,
26         local -> Bool,
27     }
28 }
29
30 table! {
31     comment_aggregates (id) {
32         id -> Int4,
33         comment_id -> Int4,
34         score -> Int8,
35         upvotes -> Int8,
36         downvotes -> Int8,
37         published -> Timestamp,
38     }
39 }
40
41 table! {
42     comment_like (id) {
43         id -> Int4,
44         person_id -> Int4,
45         comment_id -> Int4,
46         post_id -> Int4,
47         score -> Int2,
48         published -> Timestamp,
49     }
50 }
51
52 table! {
53     comment_report (id) {
54         id -> Int4,
55         creator_id -> Int4,
56         comment_id -> Int4,
57         original_comment_text -> Text,
58         reason -> Text,
59         resolved -> Bool,
60         resolver_id -> Nullable<Int4>,
61         published -> Timestamp,
62         updated -> Nullable<Timestamp>,
63     }
64 }
65
66 table! {
67     comment_saved (id) {
68         id -> Int4,
69         comment_id -> Int4,
70         person_id -> Int4,
71         published -> Timestamp,
72     }
73 }
74
75 table! {
76     community (id) {
77         id -> Int4,
78         name -> Varchar,
79         title -> Varchar,
80         description -> Nullable<Text>,
81         removed -> Bool,
82         published -> Timestamp,
83         updated -> Nullable<Timestamp>,
84         deleted -> Bool,
85         nsfw -> Bool,
86         actor_id -> Varchar,
87         local -> Bool,
88         private_key -> Nullable<Text>,
89         public_key -> Text,
90         last_refreshed_at -> Timestamp,
91         icon -> Nullable<Varchar>,
92         banner -> Nullable<Varchar>,
93         followers_url -> Varchar,
94         inbox_url -> Varchar,
95         shared_inbox_url -> Nullable<Varchar>,
96         hidden -> Bool,
97     }
98 }
99
100 table! {
101     community_aggregates (id) {
102         id -> Int4,
103         community_id -> Int4,
104         subscribers -> Int8,
105         posts -> Int8,
106         comments -> Int8,
107         published -> Timestamp,
108         users_active_day -> Int8,
109         users_active_week -> Int8,
110         users_active_month -> Int8,
111         users_active_half_year -> Int8,
112     }
113 }
114
115 table! {
116     community_follower (id) {
117         id -> Int4,
118         community_id -> Int4,
119         person_id -> Int4,
120         published -> Timestamp,
121         pending -> Nullable<Bool>,
122     }
123 }
124
125 table! {
126     community_moderator (id) {
127         id -> Int4,
128         community_id -> Int4,
129         person_id -> Int4,
130         published -> Timestamp,
131     }
132 }
133
134 table! {
135     community_person_ban (id) {
136         id -> Int4,
137         community_id -> Int4,
138         person_id -> Int4,
139         published -> Timestamp,
140         expires -> Nullable<Timestamp>,
141     }
142 }
143
144 table! {
145     local_user (id) {
146         id -> Int4,
147         person_id -> Int4,
148         password_encrypted -> Text,
149         email -> Nullable<Text>,
150         show_nsfw -> Bool,
151         theme -> Varchar,
152         default_sort_type -> Int2,
153         default_listing_type -> Int2,
154         lang -> Varchar,
155         show_avatars -> Bool,
156         send_notifications_to_email -> Bool,
157         validator_time -> Timestamp,
158         show_bot_accounts -> Bool,
159         show_scores -> Bool,
160         show_read_posts -> Bool,
161         show_new_post_notifs -> Bool,
162         email_verified -> Bool,
163         accepted_application -> Bool,
164     }
165 }
166
167 table! {
168     mod_add (id) {
169         id -> Int4,
170         mod_person_id -> Int4,
171         other_person_id -> Int4,
172         removed -> Nullable<Bool>,
173         when_ -> Timestamp,
174     }
175 }
176
177 table! {
178     mod_add_community (id) {
179         id -> Int4,
180         mod_person_id -> Int4,
181         other_person_id -> Int4,
182         community_id -> Int4,
183         removed -> Nullable<Bool>,
184         when_ -> Timestamp,
185     }
186 }
187
188 table! {
189     mod_transfer_community (id) {
190         id -> Int4,
191         mod_person_id -> Int4,
192         other_person_id -> Int4,
193         community_id -> Int4,
194         removed -> Nullable<Bool>,
195         when_ -> Timestamp,
196     }
197 }
198
199 table! {
200     mod_ban (id) {
201         id -> Int4,
202         mod_person_id -> Int4,
203         other_person_id -> Int4,
204         reason -> Nullable<Text>,
205         banned -> Nullable<Bool>,
206         expires -> Nullable<Timestamp>,
207         when_ -> Timestamp,
208     }
209 }
210
211 table! {
212     mod_ban_from_community (id) {
213         id -> Int4,
214         mod_person_id -> Int4,
215         other_person_id -> Int4,
216         community_id -> Int4,
217         reason -> Nullable<Text>,
218         banned -> Nullable<Bool>,
219         expires -> Nullable<Timestamp>,
220         when_ -> Timestamp,
221     }
222 }
223
224 table! {
225     mod_lock_post (id) {
226         id -> Int4,
227         mod_person_id -> Int4,
228         post_id -> Int4,
229         locked -> Nullable<Bool>,
230         when_ -> Timestamp,
231     }
232 }
233
234 table! {
235     mod_remove_comment (id) {
236         id -> Int4,
237         mod_person_id -> Int4,
238         comment_id -> Int4,
239         reason -> Nullable<Text>,
240         removed -> Nullable<Bool>,
241         when_ -> Timestamp,
242     }
243 }
244
245 table! {
246     mod_remove_community (id) {
247         id -> Int4,
248         mod_person_id -> Int4,
249         community_id -> Int4,
250         reason -> Nullable<Text>,
251         removed -> Nullable<Bool>,
252         expires -> Nullable<Timestamp>,
253         when_ -> Timestamp,
254     }
255 }
256
257 table! {
258     mod_remove_post (id) {
259         id -> Int4,
260         mod_person_id -> Int4,
261         post_id -> Int4,
262         reason -> Nullable<Text>,
263         removed -> Nullable<Bool>,
264         when_ -> Timestamp,
265     }
266 }
267
268 table! {
269     mod_sticky_post (id) {
270         id -> Int4,
271         mod_person_id -> Int4,
272         post_id -> Int4,
273         stickied -> Nullable<Bool>,
274         when_ -> Timestamp,
275     }
276 }
277
278 table! {
279     password_reset_request (id) {
280         id -> Int4,
281         token_encrypted -> Text,
282         published -> Timestamp,
283         local_user_id -> Int4,
284     }
285 }
286
287 table! {
288     person (id) {
289         id -> Int4,
290         name -> Varchar,
291         display_name -> Nullable<Varchar>,
292         avatar -> Nullable<Varchar>,
293         banned -> Bool,
294         published -> Timestamp,
295         updated -> Nullable<Timestamp>,
296         actor_id -> Varchar,
297         bio -> Nullable<Text>,
298         local -> Bool,
299         private_key -> Nullable<Text>,
300         public_key -> Text,
301         last_refreshed_at -> Timestamp,
302         banner -> Nullable<Varchar>,
303         deleted -> Bool,
304         inbox_url -> Varchar,
305         shared_inbox_url -> Nullable<Varchar>,
306         matrix_user_id -> Nullable<Text>,
307         admin -> Bool,
308         bot_account -> Bool,
309         ban_expires -> Nullable<Timestamp>,
310     }
311 }
312
313 table! {
314     person_aggregates (id) {
315         id -> Int4,
316         person_id -> Int4,
317         post_count -> Int8,
318         post_score -> Int8,
319         comment_count -> Int8,
320         comment_score -> Int8,
321     }
322 }
323
324 table! {
325     person_ban (id) {
326         id -> Int4,
327         person_id -> Int4,
328         published -> Timestamp,
329     }
330 }
331
332 table! {
333     person_mention (id) {
334         id -> Int4,
335         recipient_id -> Int4,
336         comment_id -> Int4,
337         read -> Bool,
338         published -> Timestamp,
339     }
340 }
341
342 table! {
343     post (id) {
344         id -> Int4,
345         name -> Varchar,
346         url -> Nullable<Varchar>,
347         body -> Nullable<Text>,
348         creator_id -> Int4,
349         community_id -> Int4,
350         removed -> Bool,
351         locked -> Bool,
352         published -> Timestamp,
353         updated -> Nullable<Timestamp>,
354         deleted -> Bool,
355         nsfw -> Bool,
356         stickied -> Bool,
357         embed_title -> Nullable<Text>,
358         embed_description -> Nullable<Text>,
359         embed_html -> Nullable<Text>,
360         thumbnail_url -> Nullable<Text>,
361         ap_id -> Varchar,
362         local -> Bool,
363     }
364 }
365
366 table! {
367     post_aggregates (id) {
368         id -> Int4,
369         post_id -> Int4,
370         comments -> Int8,
371         score -> Int8,
372         upvotes -> Int8,
373         downvotes -> Int8,
374         stickied -> Bool,
375         published -> Timestamp,
376         newest_comment_time_necro -> Timestamp,
377         newest_comment_time -> Timestamp,
378     }
379 }
380
381 table! {
382     post_like (id) {
383         id -> Int4,
384         post_id -> Int4,
385         person_id -> Int4,
386         score -> Int2,
387         published -> Timestamp,
388     }
389 }
390
391 table! {
392     post_read (id) {
393         id -> Int4,
394         post_id -> Int4,
395         person_id -> Int4,
396         published -> Timestamp,
397     }
398 }
399
400 table! {
401     post_report (id) {
402         id -> Int4,
403         creator_id -> Int4,
404         post_id -> Int4,
405         original_post_name -> Varchar,
406         original_post_url -> Nullable<Text>,
407         original_post_body -> Nullable<Text>,
408         reason -> Text,
409         resolved -> Bool,
410         resolver_id -> Nullable<Int4>,
411         published -> Timestamp,
412         updated -> Nullable<Timestamp>,
413     }
414 }
415
416 table! {
417     post_saved (id) {
418         id -> Int4,
419         post_id -> Int4,
420         person_id -> Int4,
421         published -> Timestamp,
422     }
423 }
424
425 table! {
426     private_message (id) {
427         id -> Int4,
428         creator_id -> Int4,
429         recipient_id -> Int4,
430         content -> Text,
431         deleted -> Bool,
432         read -> Bool,
433         published -> Timestamp,
434         updated -> Nullable<Timestamp>,
435         ap_id -> Varchar,
436         local -> Bool,
437     }
438 }
439
440 table! {
441     site (id) {
442         id -> Int4,
443         name -> Varchar,
444         sidebar -> Nullable<Text>,
445         published -> Timestamp,
446         updated -> Nullable<Timestamp>,
447         enable_downvotes -> Bool,
448         open_registration -> Bool,
449         enable_nsfw -> Bool,
450         icon -> Nullable<Varchar>,
451         banner -> Nullable<Varchar>,
452         description -> Nullable<Text>,
453         community_creation_admin_only -> Bool,
454         require_email_verification -> Bool,
455         require_application -> Bool,
456         application_question -> Nullable<Text>,
457         private_instance -> Bool,
458         actor_id -> Text,
459         last_refreshed_at -> Timestamp,
460         inbox_url -> Text,
461         private_key -> Nullable<Text>,
462         public_key -> Text,
463         default_theme -> Text,
464         default_post_listing_type -> Text,
465     }
466 }
467
468 table! {
469     site_aggregates (id) {
470         id -> Int4,
471         site_id -> Int4,
472         users -> Int8,
473         posts -> Int8,
474         comments -> Int8,
475         communities -> Int8,
476         users_active_day -> Int8,
477         users_active_week -> Int8,
478         users_active_month -> Int8,
479         users_active_half_year -> Int8,
480     }
481 }
482
483 table! {
484     person_block (id) {
485         id -> Int4,
486         person_id -> Int4,
487         target_id -> Int4,
488         published -> Timestamp,
489     }
490 }
491
492 table! {
493     community_block (id) {
494         id -> Int4,
495         person_id -> Int4,
496         community_id -> Int4,
497         published -> Timestamp,
498     }
499 }
500
501 // These are necessary since diesel doesn't have self joins / aliases
502 table! {
503     comment_alias_1 (id) {
504         id -> Int4,
505         creator_id -> Int4,
506         post_id -> Int4,
507         parent_id -> Nullable<Int4>,
508         content -> Text,
509         removed -> Bool,
510         read -> Bool,
511         published -> Timestamp,
512         updated -> Nullable<Timestamp>,
513         deleted -> Bool,
514         ap_id -> Varchar,
515         local -> Bool,
516     }
517 }
518
519 table! {
520     person_alias_1 (id) {
521         id -> Int4,
522         name -> Varchar,
523         display_name -> Nullable<Varchar>,
524         avatar -> Nullable<Varchar>,
525         banned -> Bool,
526         published -> Timestamp,
527         updated -> Nullable<Timestamp>,
528         actor_id -> Varchar,
529         bio -> Nullable<Text>,
530         local -> Bool,
531         private_key -> Nullable<Text>,
532         public_key -> Text,
533         last_refreshed_at -> Timestamp,
534         banner -> Nullable<Varchar>,
535         deleted -> Bool,
536         inbox_url -> Varchar,
537         shared_inbox_url -> Nullable<Varchar>,
538         matrix_user_id -> Nullable<Text>,
539         admin -> Bool,
540         bot_account -> Bool,
541         ban_expires -> Nullable<Timestamp>,
542     }
543 }
544
545 table! {
546     person_alias_2 (id) {
547         id -> Int4,
548         name -> Varchar,
549         display_name -> Nullable<Varchar>,
550         avatar -> Nullable<Varchar>,
551         banned -> Bool,
552         published -> Timestamp,
553         updated -> Nullable<Timestamp>,
554         actor_id -> Varchar,
555         bio -> Nullable<Text>,
556         local -> Bool,
557         private_key -> Nullable<Text>,
558         public_key -> Text,
559         last_refreshed_at -> Timestamp,
560         banner -> Nullable<Varchar>,
561         deleted -> Bool,
562         inbox_url -> Varchar,
563         shared_inbox_url -> Nullable<Varchar>,
564         matrix_user_id -> Nullable<Text>,
565         admin -> Bool,
566         bot_account -> Bool,
567         ban_expires -> Nullable<Timestamp>,
568     }
569 }
570
571 table! {
572   secret(id) {
573     id -> Int4,
574     jwt_secret -> Varchar,
575   }
576 }
577
578 table! {
579   email_verification (id) {
580     id -> Int4,
581     local_user_id -> Int4,
582     email -> Text,
583     verification_token -> Varchar,
584     published -> Timestamp,
585   }
586 }
587
588 table! {
589     registration_application (id) {
590         id -> Int4,
591         local_user_id -> Int4,
592         answer -> Text,
593         admin_id -> Nullable<Int4>,
594         deny_reason -> Nullable<Text>,
595         published -> Timestamp,
596     }
597 }
598
599 table! {
600     mod_hide_community (id) {
601         id -> Int4,
602         community_id -> Int4,
603         mod_person_id -> Int4,
604         reason -> Nullable<Text>,
605         hidden -> Nullable<Bool>,
606         when_ -> Timestamp,
607     }
608 }
609
610 joinable!(comment_alias_1 -> person_alias_1 (creator_id));
611 joinable!(comment -> comment_alias_1 (parent_id));
612 joinable!(person_mention -> person_alias_1 (recipient_id));
613 joinable!(post -> person_alias_1 (creator_id));
614 joinable!(comment -> person_alias_1 (creator_id));
615
616 joinable!(post_report -> person_alias_2 (resolver_id));
617 joinable!(comment_report -> person_alias_2 (resolver_id));
618
619 joinable!(person_block -> person (person_id));
620 joinable!(person_block -> person_alias_1 (target_id));
621
622 joinable!(comment -> person (creator_id));
623 joinable!(comment -> post (post_id));
624 joinable!(comment_aggregates -> comment (comment_id));
625 joinable!(comment_like -> comment (comment_id));
626 joinable!(comment_like -> person (person_id));
627 joinable!(comment_like -> post (post_id));
628 joinable!(comment_report -> comment (comment_id));
629 joinable!(comment_saved -> comment (comment_id));
630 joinable!(comment_saved -> person (person_id));
631 joinable!(community_aggregates -> community (community_id));
632 joinable!(community_block -> community (community_id));
633 joinable!(community_block -> person (person_id));
634 joinable!(community_follower -> community (community_id));
635 joinable!(community_follower -> person (person_id));
636 joinable!(community_moderator -> community (community_id));
637 joinable!(community_moderator -> person (person_id));
638 joinable!(community_person_ban -> community (community_id));
639 joinable!(community_person_ban -> person (person_id));
640 joinable!(local_user -> person (person_id));
641 joinable!(mod_add_community -> community (community_id));
642 joinable!(mod_transfer_community -> community (community_id));
643 joinable!(mod_ban_from_community -> community (community_id));
644 joinable!(mod_lock_post -> person (mod_person_id));
645 joinable!(mod_lock_post -> post (post_id));
646 joinable!(mod_remove_comment -> comment (comment_id));
647 joinable!(mod_remove_comment -> person (mod_person_id));
648 joinable!(mod_remove_community -> community (community_id));
649 joinable!(mod_remove_community -> person (mod_person_id));
650 joinable!(mod_remove_post -> person (mod_person_id));
651 joinable!(mod_remove_post -> post (post_id));
652 joinable!(mod_sticky_post -> person (mod_person_id));
653 joinable!(mod_sticky_post -> post (post_id));
654 joinable!(password_reset_request -> local_user (local_user_id));
655 joinable!(person_aggregates -> person (person_id));
656 joinable!(person_ban -> person (person_id));
657 joinable!(person_mention -> comment (comment_id));
658 joinable!(person_mention -> person (recipient_id));
659 joinable!(post -> community (community_id));
660 joinable!(post -> person (creator_id));
661 joinable!(post_aggregates -> post (post_id));
662 joinable!(post_like -> person (person_id));
663 joinable!(post_like -> post (post_id));
664 joinable!(post_read -> person (person_id));
665 joinable!(post_read -> post (post_id));
666 joinable!(post_report -> post (post_id));
667 joinable!(post_saved -> person (person_id));
668 joinable!(post_saved -> post (post_id));
669 joinable!(site_aggregates -> site (site_id));
670 joinable!(email_verification -> local_user (local_user_id));
671 joinable!(registration_application -> local_user (local_user_id));
672 joinable!(registration_application -> person (admin_id));
673 joinable!(mod_hide_community -> person (mod_person_id));
674 joinable!(mod_hide_community -> community (community_id));
675
676 allow_tables_to_appear_in_same_query!(
677   activity,
678   comment,
679   comment_aggregates,
680   community_block,
681   comment_like,
682   comment_report,
683   comment_saved,
684   community,
685   community_aggregates,
686   community_follower,
687   community_moderator,
688   community_person_ban,
689   local_user,
690   mod_add,
691   mod_add_community,
692   mod_transfer_community,
693   mod_ban,
694   mod_ban_from_community,
695   mod_lock_post,
696   mod_remove_comment,
697   mod_remove_community,
698   mod_remove_post,
699   mod_sticky_post,
700   mod_hide_community,
701   password_reset_request,
702   person,
703   person_aggregates,
704   person_ban,
705   person_block,
706   person_mention,
707   post,
708   post_aggregates,
709   post_like,
710   post_read,
711   post_report,
712   post_saved,
713   private_message,
714   site,
715   site_aggregates,
716   comment_alias_1,
717   person_alias_1,
718   person_alias_2,
719   email_verification,
720   registration_application
721 );