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