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