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