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