]> Untitled Git - lemmy.git/blob - crates/db_schema/src/schema.rs
Adding ModTransferCommunity to modlog in API. Fixes #1437
[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 // These are necessary since diesel doesn't have self joins / aliases
469 table! {
470     comment_alias_1 (id) {
471         id -> Int4,
472         creator_id -> Int4,
473         post_id -> Int4,
474         parent_id -> Nullable<Int4>,
475         content -> Text,
476         removed -> Bool,
477         read -> Bool,
478         published -> Timestamp,
479         updated -> Nullable<Timestamp>,
480         deleted -> Bool,
481         ap_id -> Varchar,
482         local -> Bool,
483     }
484 }
485
486 table! {
487     person_alias_1 (id) {
488         id -> Int4,
489         name -> Varchar,
490         display_name -> Nullable<Varchar>,
491         avatar -> Nullable<Varchar>,
492         banned -> Bool,
493         published -> Timestamp,
494         updated -> Nullable<Timestamp>,
495         actor_id -> Varchar,
496         bio -> Nullable<Text>,
497         local -> Bool,
498         private_key -> Nullable<Text>,
499         public_key -> Nullable<Text>,
500         last_refreshed_at -> Timestamp,
501         banner -> Nullable<Varchar>,
502         deleted -> Bool,
503         inbox_url -> Varchar,
504         shared_inbox_url -> Nullable<Varchar>,
505         matrix_user_id -> Nullable<Text>,
506         admin -> Bool,
507         bot_account -> Bool,
508     }
509 }
510
511 table! {
512     person_alias_2 (id) {
513         id -> Int4,
514         name -> Varchar,
515         display_name -> Nullable<Varchar>,
516         avatar -> Nullable<Varchar>,
517         banned -> Bool,
518         published -> Timestamp,
519         updated -> Nullable<Timestamp>,
520         actor_id -> Varchar,
521         bio -> Nullable<Text>,
522         local -> Bool,
523         private_key -> Nullable<Text>,
524         public_key -> Nullable<Text>,
525         last_refreshed_at -> Timestamp,
526         banner -> Nullable<Varchar>,
527         deleted -> Bool,
528         inbox_url -> Varchar,
529         shared_inbox_url -> Nullable<Varchar>,
530         matrix_user_id -> Nullable<Text>,
531         admin -> Bool,
532         bot_account -> Bool,
533     }
534 }
535
536 joinable!(comment_alias_1 -> person_alias_1 (creator_id));
537 joinable!(comment -> comment_alias_1 (parent_id));
538 joinable!(person_mention -> person_alias_1 (recipient_id));
539 joinable!(post -> person_alias_1 (creator_id));
540 joinable!(comment -> person_alias_1 (creator_id));
541
542 joinable!(post_report -> person_alias_2 (resolver_id));
543 joinable!(comment_report -> person_alias_2 (resolver_id));
544
545 joinable!(comment -> person (creator_id));
546 joinable!(comment -> post (post_id));
547 joinable!(comment_aggregates -> comment (comment_id));
548 joinable!(comment_like -> comment (comment_id));
549 joinable!(comment_like -> person (person_id));
550 joinable!(comment_like -> post (post_id));
551 joinable!(comment_report -> comment (comment_id));
552 joinable!(comment_saved -> comment (comment_id));
553 joinable!(comment_saved -> person (person_id));
554 joinable!(community_aggregates -> community (community_id));
555 joinable!(community_follower -> community (community_id));
556 joinable!(community_follower -> person (person_id));
557 joinable!(community_moderator -> community (community_id));
558 joinable!(community_moderator -> person (person_id));
559 joinable!(community_person_ban -> community (community_id));
560 joinable!(community_person_ban -> person (person_id));
561 joinable!(local_user -> person (person_id));
562 joinable!(mod_add_community -> community (community_id));
563 joinable!(mod_transfer_community -> community (community_id));
564 joinable!(mod_ban_from_community -> community (community_id));
565 joinable!(mod_lock_post -> person (mod_person_id));
566 joinable!(mod_lock_post -> post (post_id));
567 joinable!(mod_remove_comment -> comment (comment_id));
568 joinable!(mod_remove_comment -> person (mod_person_id));
569 joinable!(mod_remove_community -> community (community_id));
570 joinable!(mod_remove_community -> person (mod_person_id));
571 joinable!(mod_remove_post -> person (mod_person_id));
572 joinable!(mod_remove_post -> post (post_id));
573 joinable!(mod_sticky_post -> person (mod_person_id));
574 joinable!(mod_sticky_post -> post (post_id));
575 joinable!(password_reset_request -> local_user (local_user_id));
576 joinable!(person_aggregates -> person (person_id));
577 joinable!(person_ban -> person (person_id));
578 joinable!(person_mention -> comment (comment_id));
579 joinable!(person_mention -> person (recipient_id));
580 joinable!(post -> community (community_id));
581 joinable!(post -> person (creator_id));
582 joinable!(post_aggregates -> post (post_id));
583 joinable!(post_like -> person (person_id));
584 joinable!(post_like -> post (post_id));
585 joinable!(post_read -> person (person_id));
586 joinable!(post_read -> post (post_id));
587 joinable!(post_report -> post (post_id));
588 joinable!(post_saved -> person (person_id));
589 joinable!(post_saved -> post (post_id));
590 joinable!(site -> person (creator_id));
591 joinable!(site_aggregates -> site (site_id));
592
593 allow_tables_to_appear_in_same_query!(
594   activity,
595   comment,
596   comment_aggregates,
597   comment_like,
598   comment_report,
599   comment_saved,
600   community,
601   community_aggregates,
602   community_follower,
603   community_moderator,
604   community_person_ban,
605   local_user,
606   mod_add,
607   mod_add_community,
608   mod_transfer_community,
609   mod_ban,
610   mod_ban_from_community,
611   mod_lock_post,
612   mod_remove_comment,
613   mod_remove_community,
614   mod_remove_post,
615   mod_sticky_post,
616   password_reset_request,
617   person,
618   person_aggregates,
619   person_ban,
620   person_mention,
621   post,
622   post_aggregates,
623   post_like,
624   post_read,
625   post_report,
626   post_saved,
627   private_message,
628   site,
629   site_aggregates,
630   comment_alias_1,
631   person_alias_1,
632   person_alias_2,
633 );