]> Untitled Git - lemmy.git/blob - crates/db_schema/src/schema.rs
Removing community.creator column. Fixes #1504 (#1541)
[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_scores -> Bool,
157     }
158 }
159
160 table! {
161     mod_add (id) {
162         id -> Int4,
163         mod_person_id -> Int4,
164         other_person_id -> Int4,
165         removed -> Nullable<Bool>,
166         when_ -> Timestamp,
167     }
168 }
169
170 table! {
171     mod_add_community (id) {
172         id -> Int4,
173         mod_person_id -> Int4,
174         other_person_id -> Int4,
175         community_id -> Int4,
176         removed -> Nullable<Bool>,
177         when_ -> Timestamp,
178     }
179 }
180
181 table! {
182     mod_ban (id) {
183         id -> Int4,
184         mod_person_id -> Int4,
185         other_person_id -> Int4,
186         reason -> Nullable<Text>,
187         banned -> Nullable<Bool>,
188         expires -> Nullable<Timestamp>,
189         when_ -> Timestamp,
190     }
191 }
192
193 table! {
194     mod_ban_from_community (id) {
195         id -> Int4,
196         mod_person_id -> Int4,
197         other_person_id -> Int4,
198         community_id -> Int4,
199         reason -> Nullable<Text>,
200         banned -> Nullable<Bool>,
201         expires -> Nullable<Timestamp>,
202         when_ -> Timestamp,
203     }
204 }
205
206 table! {
207     mod_lock_post (id) {
208         id -> Int4,
209         mod_person_id -> Int4,
210         post_id -> Int4,
211         locked -> Nullable<Bool>,
212         when_ -> Timestamp,
213     }
214 }
215
216 table! {
217     mod_remove_comment (id) {
218         id -> Int4,
219         mod_person_id -> Int4,
220         comment_id -> Int4,
221         reason -> Nullable<Text>,
222         removed -> Nullable<Bool>,
223         when_ -> Timestamp,
224     }
225 }
226
227 table! {
228     mod_remove_community (id) {
229         id -> Int4,
230         mod_person_id -> Int4,
231         community_id -> Int4,
232         reason -> Nullable<Text>,
233         removed -> Nullable<Bool>,
234         expires -> Nullable<Timestamp>,
235         when_ -> Timestamp,
236     }
237 }
238
239 table! {
240     mod_remove_post (id) {
241         id -> Int4,
242         mod_person_id -> Int4,
243         post_id -> Int4,
244         reason -> Nullable<Text>,
245         removed -> Nullable<Bool>,
246         when_ -> Timestamp,
247     }
248 }
249
250 table! {
251     mod_sticky_post (id) {
252         id -> Int4,
253         mod_person_id -> Int4,
254         post_id -> Int4,
255         stickied -> Nullable<Bool>,
256         when_ -> Timestamp,
257     }
258 }
259
260 table! {
261     password_reset_request (id) {
262         id -> Int4,
263         token_encrypted -> Text,
264         published -> Timestamp,
265         local_user_id -> Int4,
266     }
267 }
268
269 table! {
270     person (id) {
271         id -> Int4,
272         name -> Varchar,
273         display_name -> Nullable<Varchar>,
274         avatar -> Nullable<Varchar>,
275         banned -> Bool,
276         published -> Timestamp,
277         updated -> Nullable<Timestamp>,
278         actor_id -> Varchar,
279         bio -> Nullable<Text>,
280         local -> Bool,
281         private_key -> Nullable<Text>,
282         public_key -> Nullable<Text>,
283         last_refreshed_at -> Timestamp,
284         banner -> Nullable<Varchar>,
285         deleted -> Bool,
286         inbox_url -> Varchar,
287         shared_inbox_url -> Nullable<Varchar>,
288         matrix_user_id -> Nullable<Text>,
289         admin -> Bool,
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         sidebar -> 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         description -> Nullable<Text>,
434     }
435 }
436
437 table! {
438     site_aggregates (id) {
439         id -> Int4,
440         site_id -> Int4,
441         users -> Int8,
442         posts -> Int8,
443         comments -> Int8,
444         communities -> Int8,
445         users_active_day -> Int8,
446         users_active_week -> Int8,
447         users_active_month -> Int8,
448         users_active_half_year -> Int8,
449     }
450 }
451
452 // These are necessary since diesel doesn't have self joins / aliases
453 table! {
454     comment_alias_1 (id) {
455         id -> Int4,
456         creator_id -> Int4,
457         post_id -> Int4,
458         parent_id -> Nullable<Int4>,
459         content -> Text,
460         removed -> Bool,
461         read -> Bool,
462         published -> Timestamp,
463         updated -> Nullable<Timestamp>,
464         deleted -> Bool,
465         ap_id -> Varchar,
466         local -> Bool,
467     }
468 }
469
470 table! {
471     person_alias_1 (id) {
472         id -> Int4,
473         name -> Varchar,
474         display_name -> Nullable<Varchar>,
475         avatar -> Nullable<Varchar>,
476         banned -> Bool,
477         published -> Timestamp,
478         updated -> Nullable<Timestamp>,
479         actor_id -> Varchar,
480         bio -> Nullable<Text>,
481         local -> Bool,
482         private_key -> Nullable<Text>,
483         public_key -> Nullable<Text>,
484         last_refreshed_at -> Timestamp,
485         banner -> Nullable<Varchar>,
486         deleted -> Bool,
487         inbox_url -> Varchar,
488         shared_inbox_url -> Nullable<Varchar>,
489         matrix_user_id -> Nullable<Text>,
490         admin -> Bool,
491     }
492 }
493
494 table! {
495     person_alias_2 (id) {
496         id -> Int4,
497         name -> Varchar,
498         display_name -> Nullable<Varchar>,
499         avatar -> Nullable<Varchar>,
500         banned -> Bool,
501         published -> Timestamp,
502         updated -> Nullable<Timestamp>,
503         actor_id -> Varchar,
504         bio -> Nullable<Text>,
505         local -> Bool,
506         private_key -> Nullable<Text>,
507         public_key -> Nullable<Text>,
508         last_refreshed_at -> Timestamp,
509         banner -> Nullable<Varchar>,
510         deleted -> Bool,
511         inbox_url -> Varchar,
512         shared_inbox_url -> Nullable<Varchar>,
513         matrix_user_id -> Nullable<Text>,
514         admin -> Bool,
515     }
516 }
517
518 joinable!(comment_alias_1 -> person_alias_1 (creator_id));
519 joinable!(comment -> comment_alias_1 (parent_id));
520 joinable!(person_mention -> person_alias_1 (recipient_id));
521 joinable!(post -> person_alias_1 (creator_id));
522 joinable!(comment -> person_alias_1 (creator_id));
523
524 joinable!(post_report -> person_alias_2 (resolver_id));
525 joinable!(comment_report -> person_alias_2 (resolver_id));
526
527 joinable!(comment -> person (creator_id));
528 joinable!(comment -> post (post_id));
529 joinable!(comment_aggregates -> comment (comment_id));
530 joinable!(comment_like -> comment (comment_id));
531 joinable!(comment_like -> person (person_id));
532 joinable!(comment_like -> post (post_id));
533 joinable!(comment_report -> comment (comment_id));
534 joinable!(comment_saved -> comment (comment_id));
535 joinable!(comment_saved -> person (person_id));
536 joinable!(community_aggregates -> community (community_id));
537 joinable!(community_follower -> community (community_id));
538 joinable!(community_follower -> person (person_id));
539 joinable!(community_moderator -> community (community_id));
540 joinable!(community_moderator -> person (person_id));
541 joinable!(community_person_ban -> community (community_id));
542 joinable!(community_person_ban -> person (person_id));
543 joinable!(local_user -> person (person_id));
544 joinable!(mod_add_community -> community (community_id));
545 joinable!(mod_ban_from_community -> community (community_id));
546 joinable!(mod_lock_post -> person (mod_person_id));
547 joinable!(mod_lock_post -> post (post_id));
548 joinable!(mod_remove_comment -> comment (comment_id));
549 joinable!(mod_remove_comment -> person (mod_person_id));
550 joinable!(mod_remove_community -> community (community_id));
551 joinable!(mod_remove_community -> person (mod_person_id));
552 joinable!(mod_remove_post -> person (mod_person_id));
553 joinable!(mod_remove_post -> post (post_id));
554 joinable!(mod_sticky_post -> person (mod_person_id));
555 joinable!(mod_sticky_post -> post (post_id));
556 joinable!(password_reset_request -> local_user (local_user_id));
557 joinable!(person_aggregates -> person (person_id));
558 joinable!(person_ban -> person (person_id));
559 joinable!(person_mention -> comment (comment_id));
560 joinable!(person_mention -> person (recipient_id));
561 joinable!(post -> community (community_id));
562 joinable!(post -> person (creator_id));
563 joinable!(post_aggregates -> post (post_id));
564 joinable!(post_like -> person (person_id));
565 joinable!(post_like -> post (post_id));
566 joinable!(post_read -> person (person_id));
567 joinable!(post_read -> post (post_id));
568 joinable!(post_report -> post (post_id));
569 joinable!(post_saved -> person (person_id));
570 joinable!(post_saved -> post (post_id));
571 joinable!(site -> person (creator_id));
572 joinable!(site_aggregates -> site (site_id));
573
574 allow_tables_to_appear_in_same_query!(
575   activity,
576   comment,
577   comment_aggregates,
578   comment_like,
579   comment_report,
580   comment_saved,
581   community,
582   community_aggregates,
583   community_follower,
584   community_moderator,
585   community_person_ban,
586   local_user,
587   mod_add,
588   mod_add_community,
589   mod_ban,
590   mod_ban_from_community,
591   mod_lock_post,
592   mod_remove_comment,
593   mod_remove_community,
594   mod_remove_post,
595   mod_sticky_post,
596   password_reset_request,
597   person,
598   person_aggregates,
599   person_ban,
600   person_mention,
601   post,
602   post_aggregates,
603   post_like,
604   post_read,
605   post_report,
606   post_saved,
607   private_message,
608   site,
609   site_aggregates,
610   comment_alias_1,
611   person_alias_1,
612   person_alias_2,
613 );