]> Untitled Git - lemmy.git/blob - crates/db_schema/src/schema.rs
Mark accounts as bot nutomic (#1565)
[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     }
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         display_name -> 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         admin -> Bool,
291         bot_account -> Bool,
292     }
293 }
294
295 table! {
296     person_aggregates (id) {
297         id -> Int4,
298         person_id -> Int4,
299         post_count -> Int8,
300         post_score -> Int8,
301         comment_count -> Int8,
302         comment_score -> Int8,
303     }
304 }
305
306 table! {
307     person_ban (id) {
308         id -> Int4,
309         person_id -> Int4,
310         published -> Timestamp,
311     }
312 }
313
314 table! {
315     person_mention (id) {
316         id -> Int4,
317         recipient_id -> Int4,
318         comment_id -> Int4,
319         read -> Bool,
320         published -> Timestamp,
321     }
322 }
323
324 table! {
325     post (id) {
326         id -> Int4,
327         name -> Varchar,
328         url -> Nullable<Varchar>,
329         body -> Nullable<Text>,
330         creator_id -> Int4,
331         community_id -> Int4,
332         removed -> Bool,
333         locked -> Bool,
334         published -> Timestamp,
335         updated -> Nullable<Timestamp>,
336         deleted -> Bool,
337         nsfw -> Bool,
338         stickied -> Bool,
339         embed_title -> Nullable<Text>,
340         embed_description -> Nullable<Text>,
341         embed_html -> Nullable<Text>,
342         thumbnail_url -> Nullable<Text>,
343         ap_id -> Varchar,
344         local -> Bool,
345     }
346 }
347
348 table! {
349     post_aggregates (id) {
350         id -> Int4,
351         post_id -> Int4,
352         comments -> Int8,
353         score -> Int8,
354         upvotes -> Int8,
355         downvotes -> Int8,
356         stickied -> Bool,
357         published -> Timestamp,
358         newest_comment_time_necro -> Timestamp,
359         newest_comment_time -> Timestamp,
360     }
361 }
362
363 table! {
364     post_like (id) {
365         id -> Int4,
366         post_id -> Int4,
367         person_id -> Int4,
368         score -> Int2,
369         published -> Timestamp,
370     }
371 }
372
373 table! {
374     post_read (id) {
375         id -> Int4,
376         post_id -> Int4,
377         person_id -> Int4,
378         published -> Timestamp,
379     }
380 }
381
382 table! {
383     post_report (id) {
384         id -> Int4,
385         creator_id -> Int4,
386         post_id -> Int4,
387         original_post_name -> Varchar,
388         original_post_url -> Nullable<Text>,
389         original_post_body -> Nullable<Text>,
390         reason -> Text,
391         resolved -> Bool,
392         resolver_id -> Nullable<Int4>,
393         published -> Timestamp,
394         updated -> Nullable<Timestamp>,
395     }
396 }
397
398 table! {
399     post_saved (id) {
400         id -> Int4,
401         post_id -> Int4,
402         person_id -> Int4,
403         published -> Timestamp,
404     }
405 }
406
407 table! {
408     private_message (id) {
409         id -> Int4,
410         creator_id -> Int4,
411         recipient_id -> Int4,
412         content -> Text,
413         deleted -> Bool,
414         read -> Bool,
415         published -> Timestamp,
416         updated -> Nullable<Timestamp>,
417         ap_id -> Varchar,
418         local -> Bool,
419     }
420 }
421
422 table! {
423     site (id) {
424         id -> Int4,
425         name -> Varchar,
426         sidebar -> Nullable<Text>,
427         creator_id -> Int4,
428         published -> Timestamp,
429         updated -> Nullable<Timestamp>,
430         enable_downvotes -> Bool,
431         open_registration -> Bool,
432         enable_nsfw -> Bool,
433         icon -> Nullable<Varchar>,
434         banner -> Nullable<Varchar>,
435         description -> Nullable<Text>,
436     }
437 }
438
439 table! {
440     site_aggregates (id) {
441         id -> Int4,
442         site_id -> Int4,
443         users -> Int8,
444         posts -> Int8,
445         comments -> Int8,
446         communities -> Int8,
447         users_active_day -> Int8,
448         users_active_week -> Int8,
449         users_active_month -> Int8,
450         users_active_half_year -> Int8,
451     }
452 }
453
454 // These are necessary since diesel doesn't have self joins / aliases
455 table! {
456     comment_alias_1 (id) {
457         id -> Int4,
458         creator_id -> Int4,
459         post_id -> Int4,
460         parent_id -> Nullable<Int4>,
461         content -> Text,
462         removed -> Bool,
463         read -> Bool,
464         published -> Timestamp,
465         updated -> Nullable<Timestamp>,
466         deleted -> Bool,
467         ap_id -> Varchar,
468         local -> Bool,
469     }
470 }
471
472 table! {
473     person_alias_1 (id) {
474         id -> Int4,
475         name -> Varchar,
476         display_name -> Nullable<Varchar>,
477         avatar -> Nullable<Varchar>,
478         banned -> Bool,
479         published -> Timestamp,
480         updated -> Nullable<Timestamp>,
481         actor_id -> Varchar,
482         bio -> Nullable<Text>,
483         local -> Bool,
484         private_key -> Nullable<Text>,
485         public_key -> Nullable<Text>,
486         last_refreshed_at -> Timestamp,
487         banner -> Nullable<Varchar>,
488         deleted -> Bool,
489         inbox_url -> Varchar,
490         shared_inbox_url -> Nullable<Varchar>,
491         matrix_user_id -> Nullable<Text>,
492         admin -> Bool,
493         bot_account -> Bool,
494     }
495 }
496
497 table! {
498     person_alias_2 (id) {
499         id -> Int4,
500         name -> Varchar,
501         display_name -> Nullable<Varchar>,
502         avatar -> Nullable<Varchar>,
503         banned -> Bool,
504         published -> Timestamp,
505         updated -> Nullable<Timestamp>,
506         actor_id -> Varchar,
507         bio -> Nullable<Text>,
508         local -> Bool,
509         private_key -> Nullable<Text>,
510         public_key -> Nullable<Text>,
511         last_refreshed_at -> Timestamp,
512         banner -> Nullable<Varchar>,
513         deleted -> Bool,
514         inbox_url -> Varchar,
515         shared_inbox_url -> Nullable<Varchar>,
516         matrix_user_id -> Nullable<Text>,
517         admin -> Bool,
518         bot_account -> Bool,
519     }
520 }
521
522 joinable!(comment_alias_1 -> person_alias_1 (creator_id));
523 joinable!(comment -> comment_alias_1 (parent_id));
524 joinable!(person_mention -> person_alias_1 (recipient_id));
525 joinable!(post -> person_alias_1 (creator_id));
526 joinable!(comment -> person_alias_1 (creator_id));
527
528 joinable!(post_report -> person_alias_2 (resolver_id));
529 joinable!(comment_report -> person_alias_2 (resolver_id));
530
531 joinable!(comment -> person (creator_id));
532 joinable!(comment -> post (post_id));
533 joinable!(comment_aggregates -> comment (comment_id));
534 joinable!(comment_like -> comment (comment_id));
535 joinable!(comment_like -> person (person_id));
536 joinable!(comment_like -> post (post_id));
537 joinable!(comment_report -> comment (comment_id));
538 joinable!(comment_saved -> comment (comment_id));
539 joinable!(comment_saved -> person (person_id));
540 joinable!(community_aggregates -> community (community_id));
541 joinable!(community_follower -> community (community_id));
542 joinable!(community_follower -> person (person_id));
543 joinable!(community_moderator -> community (community_id));
544 joinable!(community_moderator -> person (person_id));
545 joinable!(community_person_ban -> community (community_id));
546 joinable!(community_person_ban -> person (person_id));
547 joinable!(local_user -> person (person_id));
548 joinable!(mod_add_community -> community (community_id));
549 joinable!(mod_ban_from_community -> community (community_id));
550 joinable!(mod_lock_post -> person (mod_person_id));
551 joinable!(mod_lock_post -> post (post_id));
552 joinable!(mod_remove_comment -> comment (comment_id));
553 joinable!(mod_remove_comment -> person (mod_person_id));
554 joinable!(mod_remove_community -> community (community_id));
555 joinable!(mod_remove_community -> person (mod_person_id));
556 joinable!(mod_remove_post -> person (mod_person_id));
557 joinable!(mod_remove_post -> post (post_id));
558 joinable!(mod_sticky_post -> person (mod_person_id));
559 joinable!(mod_sticky_post -> post (post_id));
560 joinable!(password_reset_request -> local_user (local_user_id));
561 joinable!(person_aggregates -> person (person_id));
562 joinable!(person_ban -> person (person_id));
563 joinable!(person_mention -> comment (comment_id));
564 joinable!(person_mention -> person (recipient_id));
565 joinable!(post -> community (community_id));
566 joinable!(post -> person (creator_id));
567 joinable!(post_aggregates -> post (post_id));
568 joinable!(post_like -> person (person_id));
569 joinable!(post_like -> post (post_id));
570 joinable!(post_read -> person (person_id));
571 joinable!(post_read -> post (post_id));
572 joinable!(post_report -> post (post_id));
573 joinable!(post_saved -> person (person_id));
574 joinable!(post_saved -> post (post_id));
575 joinable!(site -> person (creator_id));
576 joinable!(site_aggregates -> site (site_id));
577
578 allow_tables_to_appear_in_same_query!(
579   activity,
580   comment,
581   comment_aggregates,
582   comment_like,
583   comment_report,
584   comment_saved,
585   community,
586   community_aggregates,
587   community_follower,
588   community_moderator,
589   community_person_ban,
590   local_user,
591   mod_add,
592   mod_add_community,
593   mod_ban,
594   mod_ban_from_community,
595   mod_lock_post,
596   mod_remove_comment,
597   mod_remove_community,
598   mod_remove_post,
599   mod_sticky_post,
600   password_reset_request,
601   person,
602   person_aggregates,
603   person_ban,
604   person_mention,
605   post,
606   post_aggregates,
607   post_like,
608   post_read,
609   post_report,
610   post_saved,
611   private_message,
612   site,
613   site_aggregates,
614   comment_alias_1,
615   person_alias_1,
616   person_alias_2,
617 );