]> Untitled Git - lemmy.git/blob - crates/db_schema/src/schema.rs
Add console-subscriber (#2003)
[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     }
97 }
98
99 table! {
100     community_aggregates (id) {
101         id -> Int4,
102         community_id -> Int4,
103         subscribers -> Int8,
104         posts -> Int8,
105         comments -> Int8,
106         published -> Timestamp,
107         users_active_day -> Int8,
108         users_active_week -> Int8,
109         users_active_month -> Int8,
110         users_active_half_year -> Int8,
111     }
112 }
113
114 table! {
115     community_follower (id) {
116         id -> Int4,
117         community_id -> Int4,
118         person_id -> Int4,
119         published -> Timestamp,
120         pending -> Nullable<Bool>,
121     }
122 }
123
124 table! {
125     community_moderator (id) {
126         id -> Int4,
127         community_id -> Int4,
128         person_id -> Int4,
129         published -> Timestamp,
130     }
131 }
132
133 table! {
134     community_person_ban (id) {
135         id -> Int4,
136         community_id -> Int4,
137         person_id -> Int4,
138         published -> Timestamp,
139     }
140 }
141
142 table! {
143     local_user (id) {
144         id -> Int4,
145         person_id -> Int4,
146         password_encrypted -> Text,
147         email -> Nullable<Text>,
148         show_nsfw -> Bool,
149         theme -> Varchar,
150         default_sort_type -> Int2,
151         default_listing_type -> Int2,
152         lang -> Varchar,
153         show_avatars -> Bool,
154         send_notifications_to_email -> Bool,
155         validator_time -> Timestamp,
156         show_bot_accounts -> Bool,
157         show_scores -> Bool,
158         show_read_posts -> Bool,
159         show_new_post_notifs -> Bool,
160         email_verified -> Bool,
161         accepted_application -> Bool,
162     }
163 }
164
165 table! {
166     mod_add (id) {
167         id -> Int4,
168         mod_person_id -> Int4,
169         other_person_id -> Int4,
170         removed -> Nullable<Bool>,
171         when_ -> Timestamp,
172     }
173 }
174
175 table! {
176     mod_add_community (id) {
177         id -> Int4,
178         mod_person_id -> Int4,
179         other_person_id -> Int4,
180         community_id -> Int4,
181         removed -> Nullable<Bool>,
182         when_ -> Timestamp,
183     }
184 }
185
186 table! {
187     mod_transfer_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_ban (id) {
199         id -> Int4,
200         mod_person_id -> Int4,
201         other_person_id -> Int4,
202         reason -> Nullable<Text>,
203         banned -> Nullable<Bool>,
204         expires -> Nullable<Timestamp>,
205         when_ -> Timestamp,
206     }
207 }
208
209 table! {
210     mod_ban_from_community (id) {
211         id -> Int4,
212         mod_person_id -> Int4,
213         other_person_id -> Int4,
214         community_id -> Int4,
215         reason -> Nullable<Text>,
216         banned -> Nullable<Bool>,
217         expires -> Nullable<Timestamp>,
218         when_ -> Timestamp,
219     }
220 }
221
222 table! {
223     mod_lock_post (id) {
224         id -> Int4,
225         mod_person_id -> Int4,
226         post_id -> Int4,
227         locked -> Nullable<Bool>,
228         when_ -> Timestamp,
229     }
230 }
231
232 table! {
233     mod_remove_comment (id) {
234         id -> Int4,
235         mod_person_id -> Int4,
236         comment_id -> Int4,
237         reason -> Nullable<Text>,
238         removed -> Nullable<Bool>,
239         when_ -> Timestamp,
240     }
241 }
242
243 table! {
244     mod_remove_community (id) {
245         id -> Int4,
246         mod_person_id -> Int4,
247         community_id -> Int4,
248         reason -> Nullable<Text>,
249         removed -> Nullable<Bool>,
250         expires -> Nullable<Timestamp>,
251         when_ -> Timestamp,
252     }
253 }
254
255 table! {
256     mod_remove_post (id) {
257         id -> Int4,
258         mod_person_id -> Int4,
259         post_id -> Int4,
260         reason -> Nullable<Text>,
261         removed -> Nullable<Bool>,
262         when_ -> Timestamp,
263     }
264 }
265
266 table! {
267     mod_sticky_post (id) {
268         id -> Int4,
269         mod_person_id -> Int4,
270         post_id -> Int4,
271         stickied -> Nullable<Bool>,
272         when_ -> Timestamp,
273     }
274 }
275
276 table! {
277     password_reset_request (id) {
278         id -> Int4,
279         token_encrypted -> Text,
280         published -> Timestamp,
281         local_user_id -> Int4,
282     }
283 }
284
285 table! {
286     person (id) {
287         id -> Int4,
288         name -> Varchar,
289         display_name -> Nullable<Varchar>,
290         avatar -> Nullable<Varchar>,
291         banned -> Bool,
292         published -> Timestamp,
293         updated -> Nullable<Timestamp>,
294         actor_id -> Varchar,
295         bio -> Nullable<Text>,
296         local -> Bool,
297         private_key -> Nullable<Text>,
298         public_key -> Text,
299         last_refreshed_at -> Timestamp,
300         banner -> Nullable<Varchar>,
301         deleted -> Bool,
302         inbox_url -> Varchar,
303         shared_inbox_url -> Nullable<Varchar>,
304         matrix_user_id -> Nullable<Text>,
305         admin -> Bool,
306         bot_account -> Bool,
307     }
308 }
309
310 table! {
311     person_aggregates (id) {
312         id -> Int4,
313         person_id -> Int4,
314         post_count -> Int8,
315         post_score -> Int8,
316         comment_count -> Int8,
317         comment_score -> Int8,
318     }
319 }
320
321 table! {
322     person_ban (id) {
323         id -> Int4,
324         person_id -> Int4,
325         published -> Timestamp,
326     }
327 }
328
329 table! {
330     person_mention (id) {
331         id -> Int4,
332         recipient_id -> Int4,
333         comment_id -> Int4,
334         read -> Bool,
335         published -> Timestamp,
336     }
337 }
338
339 table! {
340     post (id) {
341         id -> Int4,
342         name -> Varchar,
343         url -> Nullable<Varchar>,
344         body -> Nullable<Text>,
345         creator_id -> Int4,
346         community_id -> Int4,
347         removed -> Bool,
348         locked -> Bool,
349         published -> Timestamp,
350         updated -> Nullable<Timestamp>,
351         deleted -> Bool,
352         nsfw -> Bool,
353         stickied -> Bool,
354         embed_title -> Nullable<Text>,
355         embed_description -> Nullable<Text>,
356         embed_html -> Nullable<Text>,
357         thumbnail_url -> Nullable<Text>,
358         ap_id -> Varchar,
359         local -> Bool,
360     }
361 }
362
363 table! {
364     post_aggregates (id) {
365         id -> Int4,
366         post_id -> Int4,
367         comments -> Int8,
368         score -> Int8,
369         upvotes -> Int8,
370         downvotes -> Int8,
371         stickied -> Bool,
372         published -> Timestamp,
373         newest_comment_time_necro -> Timestamp,
374         newest_comment_time -> Timestamp,
375     }
376 }
377
378 table! {
379     post_like (id) {
380         id -> Int4,
381         post_id -> Int4,
382         person_id -> Int4,
383         score -> Int2,
384         published -> Timestamp,
385     }
386 }
387
388 table! {
389     post_read (id) {
390         id -> Int4,
391         post_id -> Int4,
392         person_id -> Int4,
393         published -> Timestamp,
394     }
395 }
396
397 table! {
398     post_report (id) {
399         id -> Int4,
400         creator_id -> Int4,
401         post_id -> Int4,
402         original_post_name -> Varchar,
403         original_post_url -> Nullable<Text>,
404         original_post_body -> Nullable<Text>,
405         reason -> Text,
406         resolved -> Bool,
407         resolver_id -> Nullable<Int4>,
408         published -> Timestamp,
409         updated -> Nullable<Timestamp>,
410     }
411 }
412
413 table! {
414     post_saved (id) {
415         id -> Int4,
416         post_id -> Int4,
417         person_id -> Int4,
418         published -> Timestamp,
419     }
420 }
421
422 table! {
423     private_message (id) {
424         id -> Int4,
425         creator_id -> Int4,
426         recipient_id -> Int4,
427         content -> Text,
428         deleted -> Bool,
429         read -> Bool,
430         published -> Timestamp,
431         updated -> Nullable<Timestamp>,
432         ap_id -> Varchar,
433         local -> Bool,
434     }
435 }
436
437 table! {
438     site (id) {
439         id -> Int4,
440         name -> Varchar,
441         sidebar -> Nullable<Text>,
442         creator_id -> Int4,
443         published -> Timestamp,
444         updated -> Nullable<Timestamp>,
445         enable_downvotes -> Bool,
446         open_registration -> Bool,
447         enable_nsfw -> Bool,
448         icon -> Nullable<Varchar>,
449         banner -> Nullable<Varchar>,
450         description -> Nullable<Text>,
451         community_creation_admin_only -> Bool,
452         require_email_verification -> Bool,
453         require_application -> Bool,
454         application_question -> Nullable<Text>,
455         private_instance -> Bool,
456     }
457 }
458
459 table! {
460     site_aggregates (id) {
461         id -> Int4,
462         site_id -> Int4,
463         users -> Int8,
464         posts -> Int8,
465         comments -> Int8,
466         communities -> Int8,
467         users_active_day -> Int8,
468         users_active_week -> Int8,
469         users_active_month -> Int8,
470         users_active_half_year -> Int8,
471     }
472 }
473
474 table! {
475     person_block (id) {
476         id -> Int4,
477         person_id -> Int4,
478         target_id -> Int4,
479         published -> Timestamp,
480     }
481 }
482
483 table! {
484     community_block (id) {
485         id -> Int4,
486         person_id -> Int4,
487         community_id -> Int4,
488         published -> Timestamp,
489     }
490 }
491
492 // These are necessary since diesel doesn't have self joins / aliases
493 table! {
494     comment_alias_1 (id) {
495         id -> Int4,
496         creator_id -> Int4,
497         post_id -> Int4,
498         parent_id -> Nullable<Int4>,
499         content -> Text,
500         removed -> Bool,
501         read -> Bool,
502         published -> Timestamp,
503         updated -> Nullable<Timestamp>,
504         deleted -> Bool,
505         ap_id -> Varchar,
506         local -> Bool,
507     }
508 }
509
510 table! {
511     person_alias_1 (id) {
512         id -> Int4,
513         name -> Varchar,
514         display_name -> Nullable<Varchar>,
515         avatar -> Nullable<Varchar>,
516         banned -> Bool,
517         published -> Timestamp,
518         updated -> Nullable<Timestamp>,
519         actor_id -> Varchar,
520         bio -> Nullable<Text>,
521         local -> Bool,
522         private_key -> Nullable<Text>,
523         public_key -> Text,
524         last_refreshed_at -> Timestamp,
525         banner -> Nullable<Varchar>,
526         deleted -> Bool,
527         inbox_url -> Varchar,
528         shared_inbox_url -> Nullable<Varchar>,
529         matrix_user_id -> Nullable<Text>,
530         admin -> Bool,
531         bot_account -> Bool,
532     }
533 }
534
535 table! {
536     person_alias_2 (id) {
537         id -> Int4,
538         name -> Varchar,
539         display_name -> Nullable<Varchar>,
540         avatar -> Nullable<Varchar>,
541         banned -> Bool,
542         published -> Timestamp,
543         updated -> Nullable<Timestamp>,
544         actor_id -> Varchar,
545         bio -> Nullable<Text>,
546         local -> Bool,
547         private_key -> Nullable<Text>,
548         public_key -> Text,
549         last_refreshed_at -> Timestamp,
550         banner -> Nullable<Varchar>,
551         deleted -> Bool,
552         inbox_url -> Varchar,
553         shared_inbox_url -> Nullable<Varchar>,
554         matrix_user_id -> Nullable<Text>,
555         admin -> Bool,
556         bot_account -> Bool,
557     }
558 }
559
560 table! {
561   secret(id) {
562     id -> Int4,
563     jwt_secret -> Varchar,
564   }
565 }
566
567 table! {
568   email_verification (id) {
569     id -> Int4,
570     local_user_id -> Int4,
571     email -> Text,
572     verification_token -> Varchar,
573     published -> Timestamp,
574   }
575 }
576
577 table! {
578     registration_application (id) {
579         id -> Int4,
580         local_user_id -> Int4,
581         answer -> Text,
582         admin_id -> Nullable<Int4>,
583         deny_reason -> Nullable<Text>,
584         published -> Timestamp,
585     }
586 }
587
588 joinable!(comment_alias_1 -> person_alias_1 (creator_id));
589 joinable!(comment -> comment_alias_1 (parent_id));
590 joinable!(person_mention -> person_alias_1 (recipient_id));
591 joinable!(post -> person_alias_1 (creator_id));
592 joinable!(comment -> person_alias_1 (creator_id));
593
594 joinable!(post_report -> person_alias_2 (resolver_id));
595 joinable!(comment_report -> person_alias_2 (resolver_id));
596
597 joinable!(person_block -> person (person_id));
598 joinable!(person_block -> person_alias_1 (target_id));
599
600 joinable!(comment -> person (creator_id));
601 joinable!(comment -> post (post_id));
602 joinable!(comment_aggregates -> comment (comment_id));
603 joinable!(comment_like -> comment (comment_id));
604 joinable!(comment_like -> person (person_id));
605 joinable!(comment_like -> post (post_id));
606 joinable!(comment_report -> comment (comment_id));
607 joinable!(comment_saved -> comment (comment_id));
608 joinable!(comment_saved -> person (person_id));
609 joinable!(community_aggregates -> community (community_id));
610 joinable!(community_block -> community (community_id));
611 joinable!(community_block -> person (person_id));
612 joinable!(community_follower -> community (community_id));
613 joinable!(community_follower -> person (person_id));
614 joinable!(community_moderator -> community (community_id));
615 joinable!(community_moderator -> person (person_id));
616 joinable!(community_person_ban -> community (community_id));
617 joinable!(community_person_ban -> person (person_id));
618 joinable!(local_user -> person (person_id));
619 joinable!(mod_add_community -> community (community_id));
620 joinable!(mod_transfer_community -> community (community_id));
621 joinable!(mod_ban_from_community -> community (community_id));
622 joinable!(mod_lock_post -> person (mod_person_id));
623 joinable!(mod_lock_post -> post (post_id));
624 joinable!(mod_remove_comment -> comment (comment_id));
625 joinable!(mod_remove_comment -> person (mod_person_id));
626 joinable!(mod_remove_community -> community (community_id));
627 joinable!(mod_remove_community -> person (mod_person_id));
628 joinable!(mod_remove_post -> person (mod_person_id));
629 joinable!(mod_remove_post -> post (post_id));
630 joinable!(mod_sticky_post -> person (mod_person_id));
631 joinable!(mod_sticky_post -> post (post_id));
632 joinable!(password_reset_request -> local_user (local_user_id));
633 joinable!(person_aggregates -> person (person_id));
634 joinable!(person_ban -> person (person_id));
635 joinable!(person_mention -> comment (comment_id));
636 joinable!(person_mention -> person (recipient_id));
637 joinable!(post -> community (community_id));
638 joinable!(post -> person (creator_id));
639 joinable!(post_aggregates -> post (post_id));
640 joinable!(post_like -> person (person_id));
641 joinable!(post_like -> post (post_id));
642 joinable!(post_read -> person (person_id));
643 joinable!(post_read -> post (post_id));
644 joinable!(post_report -> post (post_id));
645 joinable!(post_saved -> person (person_id));
646 joinable!(post_saved -> post (post_id));
647 joinable!(site -> person (creator_id));
648 joinable!(site_aggregates -> site (site_id));
649 joinable!(email_verification -> local_user (local_user_id));
650 joinable!(registration_application -> local_user (local_user_id));
651 joinable!(registration_application -> person (admin_id));
652
653 allow_tables_to_appear_in_same_query!(
654   activity,
655   comment,
656   comment_aggregates,
657   community_block,
658   comment_like,
659   comment_report,
660   comment_saved,
661   community,
662   community_aggregates,
663   community_follower,
664   community_moderator,
665   community_person_ban,
666   local_user,
667   mod_add,
668   mod_add_community,
669   mod_transfer_community,
670   mod_ban,
671   mod_ban_from_community,
672   mod_lock_post,
673   mod_remove_comment,
674   mod_remove_community,
675   mod_remove_post,
676   mod_sticky_post,
677   password_reset_request,
678   person,
679   person_aggregates,
680   person_ban,
681   person_block,
682   person_mention,
683   post,
684   post_aggregates,
685   post_like,
686   post_read,
687   post_report,
688   post_saved,
689   private_message,
690   site,
691   site_aggregates,
692   comment_alias_1,
693   person_alias_1,
694   person_alias_2,
695   email_verification,
696   registration_application
697 );