]> Untitled Git - lemmy.git/blob - crates/db_schema/src/schema.rs
870754a299a71afa5fe59ffd72ffbd749687dbb0
[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         moderators_url -> Nullable<Varchar>,
102         featured_url -> Nullable<Varchar>,
103         hidden -> Bool,
104         posting_restricted_to_mods -> Bool,
105         instance_id -> Int4,
106     }
107 }
108
109 table! {
110     community_aggregates (id) {
111         id -> Int4,
112         community_id -> Int4,
113         subscribers -> Int8,
114         posts -> Int8,
115         comments -> Int8,
116         published -> Timestamp,
117         users_active_day -> Int8,
118         users_active_week -> Int8,
119         users_active_month -> Int8,
120         users_active_half_year -> Int8,
121     }
122 }
123
124 table! {
125     community_follower (id) {
126         id -> Int4,
127         community_id -> Int4,
128         person_id -> Int4,
129         published -> Timestamp,
130         pending -> Bool,
131     }
132 }
133
134 table! {
135     community_moderator (id) {
136         id -> Int4,
137         community_id -> Int4,
138         person_id -> Int4,
139         published -> Timestamp,
140     }
141 }
142
143 table! {
144     community_person_ban (id) {
145         id -> Int4,
146         community_id -> Int4,
147         person_id -> Int4,
148         published -> Timestamp,
149         expires -> Nullable<Timestamp>,
150     }
151 }
152
153 table! {
154     local_user (id) {
155         id -> Int4,
156         person_id -> Int4,
157         password_encrypted -> Text,
158         email -> Nullable<Text>,
159         show_nsfw -> Bool,
160         theme -> Varchar,
161         default_sort_type -> Int2,
162         default_listing_type -> Int2,
163         interface_language -> Varchar,
164         show_avatars -> Bool,
165         send_notifications_to_email -> Bool,
166         validator_time -> Timestamp,
167         show_bot_accounts -> Bool,
168         show_scores -> Bool,
169         show_read_posts -> Bool,
170         show_new_post_notifs -> Bool,
171         email_verified -> Bool,
172         accepted_application -> Bool,
173         totp_2fa_secret -> Nullable<Text>,
174         totp_2fa_url -> Nullable<Text>,
175     }
176 }
177
178 table! {
179     mod_add (id) {
180         id -> Int4,
181         mod_person_id -> Int4,
182         other_person_id -> Int4,
183         removed -> Nullable<Bool>,
184         when_ -> Timestamp,
185     }
186 }
187
188 table! {
189     mod_add_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_transfer_community (id) {
201         id -> Int4,
202         mod_person_id -> Int4,
203         other_person_id -> Int4,
204         community_id -> Int4,
205         removed -> Nullable<Bool>,
206         when_ -> Timestamp,
207     }
208 }
209
210 table! {
211     mod_ban (id) {
212         id -> Int4,
213         mod_person_id -> Int4,
214         other_person_id -> Int4,
215         reason -> Nullable<Text>,
216         banned -> Nullable<Bool>,
217         expires -> Nullable<Timestamp>,
218         when_ -> Timestamp,
219     }
220 }
221
222 table! {
223     mod_ban_from_community (id) {
224         id -> Int4,
225         mod_person_id -> Int4,
226         other_person_id -> Int4,
227         community_id -> Int4,
228         reason -> Nullable<Text>,
229         banned -> Nullable<Bool>,
230         expires -> Nullable<Timestamp>,
231         when_ -> Timestamp,
232     }
233 }
234
235 table! {
236     mod_lock_post (id) {
237         id -> Int4,
238         mod_person_id -> Int4,
239         post_id -> Int4,
240         locked -> Nullable<Bool>,
241         when_ -> Timestamp,
242     }
243 }
244
245 table! {
246     mod_remove_comment (id) {
247         id -> Int4,
248         mod_person_id -> Int4,
249         comment_id -> Int4,
250         reason -> Nullable<Text>,
251         removed -> Nullable<Bool>,
252         when_ -> Timestamp,
253     }
254 }
255
256 table! {
257     mod_remove_community (id) {
258         id -> Int4,
259         mod_person_id -> Int4,
260         community_id -> Int4,
261         reason -> Nullable<Text>,
262         removed -> Nullable<Bool>,
263         expires -> Nullable<Timestamp>,
264         when_ -> Timestamp,
265     }
266 }
267
268 table! {
269     mod_remove_post (id) {
270         id -> Int4,
271         mod_person_id -> Int4,
272         post_id -> Int4,
273         reason -> Nullable<Text>,
274         removed -> Nullable<Bool>,
275         when_ -> Timestamp,
276     }
277 }
278
279 table! {
280     mod_feature_post (id) {
281         id -> Int4,
282         mod_person_id -> Int4,
283         post_id -> Int4,
284         featured -> Bool,
285         when_ -> Timestamp,
286         is_featured_community -> Bool,
287     }
288 }
289
290 table! {
291     password_reset_request (id) {
292         id -> Int4,
293         token_encrypted -> Text,
294         published -> Timestamp,
295         local_user_id -> Int4,
296     }
297 }
298
299 table! {
300     person (id) {
301         id -> Int4,
302         name -> Varchar,
303         display_name -> Nullable<Varchar>,
304         avatar -> Nullable<Varchar>,
305         banned -> Bool,
306         published -> Timestamp,
307         updated -> Nullable<Timestamp>,
308         actor_id -> Varchar,
309         bio -> Nullable<Text>,
310         local -> Bool,
311         private_key -> Nullable<Text>,
312         public_key -> Text,
313         last_refreshed_at -> Timestamp,
314         banner -> Nullable<Varchar>,
315         deleted -> Bool,
316         inbox_url -> Varchar,
317         shared_inbox_url -> Nullable<Varchar>,
318         matrix_user_id -> Nullable<Text>,
319         admin -> Bool,
320         bot_account -> Bool,
321         ban_expires -> Nullable<Timestamp>,
322         instance_id -> Int4,
323     }
324 }
325
326 table! {
327     person_aggregates (id) {
328         id -> Int4,
329         person_id -> Int4,
330         post_count -> Int8,
331         post_score -> Int8,
332         comment_count -> Int8,
333         comment_score -> Int8,
334     }
335 }
336
337 table! {
338     person_ban (id) {
339         id -> Int4,
340         person_id -> Int4,
341         published -> Timestamp,
342     }
343 }
344
345 table! {
346     person_mention (id) {
347         id -> Int4,
348         recipient_id -> Int4,
349         comment_id -> Int4,
350         read -> Bool,
351         published -> Timestamp,
352     }
353 }
354
355 table! {
356     comment_reply (id) {
357         id -> Int4,
358         recipient_id -> Int4,
359         comment_id -> Int4,
360         read -> Bool,
361         published -> Timestamp,
362     }
363 }
364
365 table! {
366     post (id) {
367         id -> Int4,
368         name -> Varchar,
369         url -> Nullable<Varchar>,
370         body -> Nullable<Text>,
371         creator_id -> Int4,
372         community_id -> Int4,
373         removed -> Bool,
374         locked -> Bool,
375         published -> Timestamp,
376         updated -> Nullable<Timestamp>,
377         deleted -> Bool,
378         nsfw -> Bool,
379         embed_title -> Nullable<Text>,
380         embed_description -> Nullable<Text>,
381         embed_video_url -> Nullable<Text>,
382         thumbnail_url -> Nullable<Text>,
383         ap_id -> Varchar,
384         local -> Bool,
385         language_id -> Int4,
386         featured_community -> Bool,
387         featured_local -> Bool,
388     }
389 }
390
391 table! {
392     person_post_aggregates (id) {
393         id -> Int4,
394         person_id -> Int4,
395         post_id -> Int4,
396         read_comments -> Int8,
397         published -> Timestamp,
398     }
399 }
400
401 table! {
402     post_aggregates (id) {
403         id -> Int4,
404         post_id -> Int4,
405         comments -> Int8,
406         score -> Int8,
407         upvotes -> Int8,
408         downvotes -> Int8,
409         published -> Timestamp,
410         newest_comment_time_necro -> Timestamp,
411         newest_comment_time -> Timestamp,
412         featured_community -> Bool,
413         featured_local -> Bool,
414     }
415 }
416
417 table! {
418     post_like (id) {
419         id -> Int4,
420         post_id -> Int4,
421         person_id -> Int4,
422         score -> Int2,
423         published -> Timestamp,
424     }
425 }
426
427 table! {
428     post_read (id) {
429         id -> Int4,
430         post_id -> Int4,
431         person_id -> Int4,
432         published -> Timestamp,
433     }
434 }
435
436 table! {
437     post_report (id) {
438         id -> Int4,
439         creator_id -> Int4,
440         post_id -> Int4,
441         original_post_name -> Varchar,
442         original_post_url -> Nullable<Text>,
443         original_post_body -> Nullable<Text>,
444         reason -> Text,
445         resolved -> Bool,
446         resolver_id -> Nullable<Int4>,
447         published -> Timestamp,
448         updated -> Nullable<Timestamp>,
449     }
450 }
451
452 table! {
453     post_saved (id) {
454         id -> Int4,
455         post_id -> Int4,
456         person_id -> Int4,
457         published -> Timestamp,
458     }
459 }
460
461 table! {
462     private_message (id) {
463         id -> Int4,
464         creator_id -> Int4,
465         recipient_id -> Int4,
466         content -> Text,
467         deleted -> Bool,
468         read -> Bool,
469         published -> Timestamp,
470         updated -> Nullable<Timestamp>,
471         ap_id -> Varchar,
472         local -> Bool,
473     }
474 }
475
476 table! {
477     private_message_report (id) {
478         id -> Int4,
479         creator_id -> Int4,
480         private_message_id -> Int4,
481         original_pm_text -> Text,
482         reason -> Text,
483         resolved -> Bool,
484         resolver_id -> Nullable<Int4>,
485         published -> Timestamp,
486         updated -> Nullable<Timestamp>,
487     }
488 }
489
490 table! {
491     site (id) {
492         id -> Int4,
493         name -> Varchar,
494         sidebar -> Nullable<Text>,
495         published -> Timestamp,
496         updated -> Nullable<Timestamp>,
497         icon -> Nullable<Varchar>,
498         banner -> Nullable<Varchar>,
499         description -> Nullable<Text>,
500         actor_id -> Text,
501         last_refreshed_at -> Timestamp,
502         inbox_url -> Text,
503         private_key -> Nullable<Text>,
504         public_key -> Text,
505         instance_id -> Int4,
506     }
507 }
508
509 table! {
510     site_aggregates (id) {
511         id -> Int4,
512         site_id -> Int4,
513         users -> Int8,
514         posts -> Int8,
515         comments -> Int8,
516         communities -> Int8,
517         users_active_day -> Int8,
518         users_active_week -> Int8,
519         users_active_month -> Int8,
520         users_active_half_year -> Int8,
521     }
522 }
523
524 table! {
525     person_block (id) {
526         id -> Int4,
527         person_id -> Int4,
528         target_id -> Int4,
529         published -> Timestamp,
530     }
531 }
532
533 table! {
534     community_block (id) {
535         id -> Int4,
536         person_id -> Int4,
537         community_id -> Int4,
538         published -> Timestamp,
539     }
540 }
541
542 table! {
543   secret(id) {
544     id -> Int4,
545     jwt_secret -> Varchar,
546   }
547 }
548
549 table! {
550   admin_purge_comment (id) {
551     id -> Int4,
552     admin_person_id -> Int4,
553     post_id -> Int4,
554     reason -> Nullable<Text>,
555     when_ -> Timestamp,
556   }
557 }
558
559 table! {
560   email_verification (id) {
561     id -> Int4,
562     local_user_id -> Int4,
563     email -> Text,
564     verification_token -> Varchar,
565     published -> Timestamp,
566   }
567 }
568
569 table! {
570   admin_purge_community (id) {
571     id -> Int4,
572     admin_person_id -> Int4,
573     reason -> Nullable<Text>,
574     when_ -> Timestamp,
575   }
576 }
577
578 table! {
579   admin_purge_person (id) {
580     id -> Int4,
581     admin_person_id -> Int4,
582     reason -> Nullable<Text>,
583     when_ -> Timestamp,
584   }
585 }
586
587 table! {
588   admin_purge_post (id) {
589     id -> Int4,
590     admin_person_id -> Int4,
591     community_id -> Int4,
592     reason -> Nullable<Text>,
593     when_ -> Timestamp,
594   }
595 }
596
597 table! {
598     registration_application (id) {
599         id -> Int4,
600         local_user_id -> Int4,
601         answer -> Text,
602         admin_id -> Nullable<Int4>,
603         deny_reason -> Nullable<Text>,
604         published -> Timestamp,
605     }
606 }
607
608 table! {
609     mod_hide_community (id) {
610         id -> Int4,
611         community_id -> Int4,
612         mod_person_id -> Int4,
613         reason -> Nullable<Text>,
614         hidden -> Nullable<Bool>,
615         when_ -> Timestamp,
616     }
617 }
618
619 table! {
620     language (id) {
621         id -> Int4,
622         code -> Text,
623         name -> Text,
624     }
625 }
626
627 table! {
628     local_user_language(id) {
629         id -> Int4,
630         local_user_id -> Int4,
631         language_id -> Int4,
632     }
633 }
634
635 table! {
636     site_language(id) {
637         id -> Int4,
638         site_id -> Int4,
639         language_id -> Int4,
640     }
641 }
642
643 table! {
644     community_language(id) {
645         id -> Int4,
646         community_id -> Int4,
647         language_id -> Int4,
648     }
649 }
650
651 table! {
652   instance(id) {
653     id -> Int4,
654     domain -> Text,
655     software -> Nullable<Text>,
656     version -> Nullable<Text>,
657     published -> Timestamp,
658     updated -> Nullable<Timestamp>,
659   }
660 }
661
662 table! {
663   federation_allowlist(id) {
664     id -> Int4,
665     instance_id -> Int4,
666     published -> Timestamp,
667     updated -> Nullable<Timestamp>,
668   }
669 }
670
671 table! {
672   federation_blocklist(id) {
673     id -> Int4,
674     instance_id -> Int4,
675     published -> Timestamp,
676     updated -> Nullable<Timestamp>,
677   }
678 }
679
680 table! {
681   use crate::source::local_site::RegistrationModeType;
682   use diesel::sql_types::*;
683
684   local_site(id) {
685     id -> Int4,
686     site_id -> Int4,
687     site_setup -> Bool,
688     enable_downvotes -> Bool,
689     enable_nsfw -> Bool,
690     community_creation_admin_only -> Bool,
691     require_email_verification -> Bool,
692     application_question -> Nullable<Text>,
693     private_instance -> Bool,
694     default_theme -> Text,
695     default_post_listing_type -> Text,
696     legal_information -> Nullable<Text>,
697     hide_modlog_mod_names -> Bool,
698     application_email_admins -> Bool,
699     slur_filter_regex -> Nullable<Text>,
700     actor_name_max_length -> Int4,
701     federation_enabled -> Bool,
702     federation_debug -> Bool,
703     federation_worker_count -> Int4,
704     captcha_enabled -> Bool,
705     captcha_difficulty -> Text,
706     registration_mode -> RegistrationModeType,
707     reports_email_admins -> Bool,
708     published -> Timestamp,
709     updated -> Nullable<Timestamp>,
710   }
711 }
712
713 table! {
714   local_site_rate_limit(id) {
715     id -> Int4,
716     local_site_id -> Int4,
717     message -> Int4,
718     message_per_second-> Int4,
719     post -> Int4,
720     post_per_second -> Int4,
721     register -> Int4,
722     register_per_second -> Int4,
723     image -> Int4,
724     image_per_second -> Int4,
725     comment -> Int4,
726     comment_per_second -> Int4,
727     search -> Int4,
728     search_per_second -> Int4,
729     published -> Timestamp,
730     updated -> Nullable<Timestamp>,
731   }
732 }
733
734 table! {
735   tagline(id) {
736     id -> Int4,
737     local_site_id -> Int4,
738     content -> Text,
739     published -> Timestamp,
740     updated -> Nullable<Timestamp>,
741   }
742 }
743
744 table! {
745     person_follower (id) {
746         id -> Int4,
747         person_id -> Int4,
748         follower_id -> Int4,
749         published -> Timestamp,
750         pending -> Bool,
751     }
752 }
753
754 joinable!(person_block -> person (person_id));
755
756 joinable!(comment -> person (creator_id));
757 joinable!(comment -> post (post_id));
758 joinable!(comment_aggregates -> comment (comment_id));
759 joinable!(comment_like -> comment (comment_id));
760 joinable!(comment_like -> person (person_id));
761 joinable!(comment_like -> post (post_id));
762 joinable!(comment_report -> comment (comment_id));
763 joinable!(comment_saved -> comment (comment_id));
764 joinable!(comment_saved -> person (person_id));
765 joinable!(community_aggregates -> community (community_id));
766 joinable!(community_block -> community (community_id));
767 joinable!(community_block -> person (person_id));
768 joinable!(community_follower -> community (community_id));
769 joinable!(community_follower -> person (person_id));
770 joinable!(community_moderator -> community (community_id));
771 joinable!(community_moderator -> person (person_id));
772 joinable!(community_person_ban -> community (community_id));
773 joinable!(community_person_ban -> person (person_id));
774 joinable!(local_user -> person (person_id));
775 joinable!(mod_add_community -> community (community_id));
776 joinable!(mod_transfer_community -> community (community_id));
777 joinable!(mod_ban_from_community -> community (community_id));
778 joinable!(mod_lock_post -> person (mod_person_id));
779 joinable!(mod_lock_post -> post (post_id));
780 joinable!(mod_remove_comment -> comment (comment_id));
781 joinable!(mod_remove_comment -> person (mod_person_id));
782 joinable!(mod_remove_community -> community (community_id));
783 joinable!(mod_remove_community -> person (mod_person_id));
784 joinable!(mod_remove_post -> person (mod_person_id));
785 joinable!(mod_remove_post -> post (post_id));
786 joinable!(mod_feature_post -> person (mod_person_id));
787 joinable!(mod_feature_post -> post (post_id));
788 joinable!(password_reset_request -> local_user (local_user_id));
789 joinable!(person_aggregates -> person (person_id));
790 joinable!(person_ban -> person (person_id));
791 joinable!(person_mention -> comment (comment_id));
792 joinable!(person_mention -> person (recipient_id));
793 joinable!(comment_reply -> comment (comment_id));
794 joinable!(comment_reply -> person (recipient_id));
795 joinable!(post -> community (community_id));
796 joinable!(post -> person (creator_id));
797 joinable!(person_post_aggregates -> post (post_id));
798 joinable!(person_post_aggregates -> person (person_id));
799 joinable!(post_aggregates -> post (post_id));
800 joinable!(post_like -> person (person_id));
801 joinable!(post_like -> post (post_id));
802 joinable!(post_read -> person (person_id));
803 joinable!(post_read -> post (post_id));
804 joinable!(post_report -> post (post_id));
805 joinable!(post_saved -> person (person_id));
806 joinable!(post_saved -> post (post_id));
807 joinable!(site_aggregates -> site (site_id));
808 joinable!(email_verification -> local_user (local_user_id));
809 joinable!(registration_application -> local_user (local_user_id));
810 joinable!(registration_application -> person (admin_id));
811 joinable!(mod_hide_community -> person (mod_person_id));
812 joinable!(mod_hide_community -> community (community_id));
813 joinable!(post -> language (language_id));
814 joinable!(comment -> language (language_id));
815 joinable!(local_user_language -> language (language_id));
816 joinable!(local_user_language -> local_user (local_user_id));
817 joinable!(private_message_report -> private_message (private_message_id));
818 joinable!(site_language -> language (language_id));
819 joinable!(site_language -> site (site_id));
820 joinable!(community_language -> language (language_id));
821 joinable!(community_language -> community (community_id));
822 joinable!(person_follower -> person (follower_id));
823
824 joinable!(admin_purge_comment -> person (admin_person_id));
825 joinable!(admin_purge_comment -> post (post_id));
826 joinable!(admin_purge_community -> person (admin_person_id));
827 joinable!(admin_purge_person -> person (admin_person_id));
828 joinable!(admin_purge_post -> community (community_id));
829 joinable!(admin_purge_post -> person (admin_person_id));
830
831 joinable!(site -> instance (instance_id));
832 joinable!(person -> instance (instance_id));
833 joinable!(community -> instance (instance_id));
834 joinable!(federation_allowlist -> instance (instance_id));
835 joinable!(federation_blocklist -> instance (instance_id));
836 joinable!(local_site -> site (site_id));
837 joinable!(local_site_rate_limit -> local_site (local_site_id));
838 joinable!(tagline -> local_site (local_site_id));
839
840 allow_tables_to_appear_in_same_query!(
841   activity,
842   comment,
843   comment_aggregates,
844   community_block,
845   comment_like,
846   comment_report,
847   comment_saved,
848   community,
849   community_aggregates,
850   community_follower,
851   community_moderator,
852   community_person_ban,
853   local_user,
854   mod_add,
855   mod_add_community,
856   mod_transfer_community,
857   mod_ban,
858   mod_ban_from_community,
859   mod_lock_post,
860   mod_remove_comment,
861   mod_remove_community,
862   mod_remove_post,
863   mod_feature_post,
864   mod_hide_community,
865   password_reset_request,
866   person,
867   person_aggregates,
868   person_ban,
869   person_block,
870   person_mention,
871   person_post_aggregates,
872   comment_reply,
873   post,
874   post_aggregates,
875   post_like,
876   post_read,
877   post_report,
878   post_saved,
879   private_message,
880   private_message_report,
881   site,
882   site_aggregates,
883   admin_purge_comment,
884   admin_purge_community,
885   admin_purge_person,
886   admin_purge_post,
887   email_verification,
888   registration_application,
889   language,
890   tagline,
891   local_user_language,
892   site_language,
893   community_language,
894   instance,
895   federation_allowlist,
896   federation_blocklist,
897   local_site,
898   local_site_rate_limit,
899   person_follower
900 );