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