]> Untitled Git - lemmy.git/blob - crates/db_schema/src/schema.rs
Moving matrix_user_id to person table. #1438
[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         validator_time -> Timestamp,
158     }
159 }
160
161 table! {
162     mod_add (id) {
163         id -> Int4,
164         mod_person_id -> Int4,
165         other_person_id -> Int4,
166         removed -> Nullable<Bool>,
167         when_ -> Timestamp,
168     }
169 }
170
171 table! {
172     mod_add_community (id) {
173         id -> Int4,
174         mod_person_id -> Int4,
175         other_person_id -> Int4,
176         community_id -> Int4,
177         removed -> Nullable<Bool>,
178         when_ -> Timestamp,
179     }
180 }
181
182 table! {
183     mod_ban (id) {
184         id -> Int4,
185         mod_person_id -> Int4,
186         other_person_id -> Int4,
187         reason -> Nullable<Text>,
188         banned -> Nullable<Bool>,
189         expires -> Nullable<Timestamp>,
190         when_ -> Timestamp,
191     }
192 }
193
194 table! {
195     mod_ban_from_community (id) {
196         id -> Int4,
197         mod_person_id -> Int4,
198         other_person_id -> Int4,
199         community_id -> Int4,
200         reason -> Nullable<Text>,
201         banned -> Nullable<Bool>,
202         expires -> Nullable<Timestamp>,
203         when_ -> Timestamp,
204     }
205 }
206
207 table! {
208     mod_lock_post (id) {
209         id -> Int4,
210         mod_person_id -> Int4,
211         post_id -> Int4,
212         locked -> Nullable<Bool>,
213         when_ -> Timestamp,
214     }
215 }
216
217 table! {
218     mod_remove_comment (id) {
219         id -> Int4,
220         mod_person_id -> Int4,
221         comment_id -> Int4,
222         reason -> Nullable<Text>,
223         removed -> Nullable<Bool>,
224         when_ -> Timestamp,
225     }
226 }
227
228 table! {
229     mod_remove_community (id) {
230         id -> Int4,
231         mod_person_id -> Int4,
232         community_id -> Int4,
233         reason -> Nullable<Text>,
234         removed -> Nullable<Bool>,
235         expires -> Nullable<Timestamp>,
236         when_ -> Timestamp,
237     }
238 }
239
240 table! {
241     mod_remove_post (id) {
242         id -> Int4,
243         mod_person_id -> Int4,
244         post_id -> Int4,
245         reason -> Nullable<Text>,
246         removed -> Nullable<Bool>,
247         when_ -> Timestamp,
248     }
249 }
250
251 table! {
252     mod_sticky_post (id) {
253         id -> Int4,
254         mod_person_id -> Int4,
255         post_id -> Int4,
256         stickied -> Nullable<Bool>,
257         when_ -> Timestamp,
258     }
259 }
260
261 table! {
262     password_reset_request (id) {
263         id -> Int4,
264         token_encrypted -> Text,
265         published -> Timestamp,
266         local_user_id -> Int4,
267     }
268 }
269
270 table! {
271     person (id) {
272         id -> Int4,
273         name -> Varchar,
274         preferred_username -> Nullable<Varchar>,
275         avatar -> Nullable<Varchar>,
276         banned -> Bool,
277         published -> Timestamp,
278         updated -> Nullable<Timestamp>,
279         actor_id -> Varchar,
280         bio -> Nullable<Text>,
281         local -> Bool,
282         private_key -> Nullable<Text>,
283         public_key -> Nullable<Text>,
284         last_refreshed_at -> Timestamp,
285         banner -> Nullable<Varchar>,
286         deleted -> Bool,
287         inbox_url -> Varchar,
288         shared_inbox_url -> Nullable<Varchar>,
289         matrix_user_id -> Nullable<Text>,
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         matrix_user_id -> Nullable<Text>,
489     }
490 }
491
492 table! {
493     person_alias_2 (id) {
494         id -> Int4,
495         name -> Varchar,
496         preferred_username -> Nullable<Varchar>,
497         avatar -> Nullable<Varchar>,
498         banned -> Bool,
499         published -> Timestamp,
500         updated -> Nullable<Timestamp>,
501         actor_id -> Varchar,
502         bio -> Nullable<Text>,
503         local -> Bool,
504         private_key -> Nullable<Text>,
505         public_key -> Nullable<Text>,
506         last_refreshed_at -> Timestamp,
507         banner -> Nullable<Varchar>,
508         deleted -> Bool,
509         inbox_url -> Varchar,
510         shared_inbox_url -> Nullable<Varchar>,
511         matrix_user_id -> Nullable<Text>,
512     }
513 }
514
515 joinable!(comment_alias_1 -> person_alias_1 (creator_id));
516 joinable!(comment -> comment_alias_1 (parent_id));
517 joinable!(person_mention -> person_alias_1 (recipient_id));
518 joinable!(post -> person_alias_1 (creator_id));
519 joinable!(comment -> person_alias_1 (creator_id));
520
521 joinable!(post_report -> person_alias_2 (resolver_id));
522 joinable!(comment_report -> person_alias_2 (resolver_id));
523
524 joinable!(comment -> person (creator_id));
525 joinable!(comment -> post (post_id));
526 joinable!(comment_aggregates -> comment (comment_id));
527 joinable!(comment_like -> comment (comment_id));
528 joinable!(comment_like -> person (person_id));
529 joinable!(comment_like -> post (post_id));
530 joinable!(comment_report -> comment (comment_id));
531 joinable!(comment_saved -> comment (comment_id));
532 joinable!(comment_saved -> person (person_id));
533 joinable!(community -> person (creator_id));
534 joinable!(community_aggregates -> community (community_id));
535 joinable!(community_follower -> community (community_id));
536 joinable!(community_follower -> person (person_id));
537 joinable!(community_moderator -> community (community_id));
538 joinable!(community_moderator -> person (person_id));
539 joinable!(community_person_ban -> community (community_id));
540 joinable!(community_person_ban -> person (person_id));
541 joinable!(local_user -> person (person_id));
542 joinable!(mod_add_community -> community (community_id));
543 joinable!(mod_ban_from_community -> community (community_id));
544 joinable!(mod_lock_post -> person (mod_person_id));
545 joinable!(mod_lock_post -> post (post_id));
546 joinable!(mod_remove_comment -> comment (comment_id));
547 joinable!(mod_remove_comment -> person (mod_person_id));
548 joinable!(mod_remove_community -> community (community_id));
549 joinable!(mod_remove_community -> person (mod_person_id));
550 joinable!(mod_remove_post -> person (mod_person_id));
551 joinable!(mod_remove_post -> post (post_id));
552 joinable!(mod_sticky_post -> person (mod_person_id));
553 joinable!(mod_sticky_post -> post (post_id));
554 joinable!(password_reset_request -> local_user (local_user_id));
555 joinable!(person_aggregates -> person (person_id));
556 joinable!(person_ban -> person (person_id));
557 joinable!(person_mention -> comment (comment_id));
558 joinable!(person_mention -> person (recipient_id));
559 joinable!(post -> community (community_id));
560 joinable!(post -> person (creator_id));
561 joinable!(post_aggregates -> post (post_id));
562 joinable!(post_like -> person (person_id));
563 joinable!(post_like -> post (post_id));
564 joinable!(post_read -> person (person_id));
565 joinable!(post_read -> post (post_id));
566 joinable!(post_report -> post (post_id));
567 joinable!(post_saved -> person (person_id));
568 joinable!(post_saved -> post (post_id));
569 joinable!(site -> person (creator_id));
570 joinable!(site_aggregates -> site (site_id));
571
572 allow_tables_to_appear_in_same_query!(
573   activity,
574   comment,
575   comment_aggregates,
576   comment_like,
577   comment_report,
578   comment_saved,
579   community,
580   community_aggregates,
581   community_follower,
582   community_moderator,
583   community_person_ban,
584   local_user,
585   mod_add,
586   mod_add_community,
587   mod_ban,
588   mod_ban_from_community,
589   mod_lock_post,
590   mod_remove_comment,
591   mod_remove_community,
592   mod_remove_post,
593   mod_sticky_post,
594   password_reset_request,
595   person,
596   person_aggregates,
597   person_ban,
598   person_mention,
599   post,
600   post_aggregates,
601   post_like,
602   post_read,
603   post_report,
604   post_saved,
605   private_message,
606   site,
607   site_aggregates,
608   comment_alias_1,
609   person_alias_1,
610   person_alias_2,
611 );