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