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