]> Untitled Git - lemmy.git/blob - server/lemmy_db/src/schema.rs
a189dbced4fa00d9bac8ff5cf8223db5efe14004
[lemmy.git] / server / lemmy_db / src / schema.rs
1 table! {
2     activity (id) {
3         id -> Int4,
4         user_id -> Int4,
5         data -> Jsonb,
6         local -> Bool,
7         published -> Timestamp,
8         updated -> Nullable<Timestamp>,
9     }
10 }
11
12 table! {
13     category (id) {
14         id -> Int4,
15         name -> Varchar,
16     }
17 }
18
19 table! {
20     comment (id) {
21         id -> Int4,
22         creator_id -> Int4,
23         post_id -> Int4,
24         parent_id -> Nullable<Int4>,
25         content -> Text,
26         removed -> Bool,
27         read -> Bool,
28         published -> Timestamp,
29         updated -> Nullable<Timestamp>,
30         deleted -> Bool,
31         ap_id -> Varchar,
32         local -> Bool,
33     }
34 }
35
36 table! {
37     comment_aggregates_fast (id) {
38         id -> Int4,
39         creator_id -> Nullable<Int4>,
40         post_id -> Nullable<Int4>,
41         parent_id -> Nullable<Int4>,
42         content -> Nullable<Text>,
43         removed -> Nullable<Bool>,
44         read -> Nullable<Bool>,
45         published -> Nullable<Timestamp>,
46         updated -> Nullable<Timestamp>,
47         deleted -> Nullable<Bool>,
48         ap_id -> Nullable<Varchar>,
49         local -> Nullable<Bool>,
50         post_name -> Nullable<Varchar>,
51         community_id -> Nullable<Int4>,
52         community_actor_id -> Nullable<Varchar>,
53         community_local -> Nullable<Bool>,
54         community_name -> Nullable<Varchar>,
55         community_icon -> Nullable<Text>,
56         banned -> Nullable<Bool>,
57         banned_from_community -> Nullable<Bool>,
58         creator_actor_id -> Nullable<Varchar>,
59         creator_local -> Nullable<Bool>,
60         creator_name -> Nullable<Varchar>,
61         creator_preferred_username -> Nullable<Varchar>,
62         creator_published -> Nullable<Timestamp>,
63         creator_avatar -> Nullable<Text>,
64         score -> Nullable<Int8>,
65         upvotes -> Nullable<Int8>,
66         downvotes -> Nullable<Int8>,
67         hot_rank -> Nullable<Int4>,
68         hot_rank_active -> Nullable<Int4>,
69     }
70 }
71
72 table! {
73     comment_like (id) {
74         id -> Int4,
75         user_id -> Int4,
76         comment_id -> Int4,
77         post_id -> Int4,
78         score -> Int2,
79         published -> Timestamp,
80     }
81 }
82
83 table! {
84     comment_saved (id) {
85         id -> Int4,
86         comment_id -> Int4,
87         user_id -> Int4,
88         published -> Timestamp,
89     }
90 }
91
92 table! {
93     community (id) {
94         id -> Int4,
95         name -> Varchar,
96         title -> Varchar,
97         description -> Nullable<Text>,
98         category_id -> Int4,
99         creator_id -> Int4,
100         removed -> Bool,
101         published -> Timestamp,
102         updated -> Nullable<Timestamp>,
103         deleted -> Bool,
104         nsfw -> Bool,
105         actor_id -> Varchar,
106         local -> Bool,
107         private_key -> Nullable<Text>,
108         public_key -> Nullable<Text>,
109         last_refreshed_at -> Timestamp,
110         icon -> Nullable<Text>,
111         banner -> Nullable<Text>,
112     }
113 }
114
115 table! {
116     community_aggregates_fast (id) {
117         id -> Int4,
118         name -> Nullable<Varchar>,
119         title -> Nullable<Varchar>,
120         icon -> Nullable<Text>,
121         banner -> Nullable<Text>,
122         description -> Nullable<Text>,
123         category_id -> Nullable<Int4>,
124         creator_id -> Nullable<Int4>,
125         removed -> Nullable<Bool>,
126         published -> Nullable<Timestamp>,
127         updated -> Nullable<Timestamp>,
128         deleted -> Nullable<Bool>,
129         nsfw -> Nullable<Bool>,
130         actor_id -> Nullable<Varchar>,
131         local -> Nullable<Bool>,
132         last_refreshed_at -> Nullable<Timestamp>,
133         creator_actor_id -> Nullable<Varchar>,
134         creator_local -> Nullable<Bool>,
135         creator_name -> Nullable<Varchar>,
136         creator_preferred_username -> Nullable<Varchar>,
137         creator_avatar -> Nullable<Text>,
138         category_name -> Nullable<Varchar>,
139         number_of_subscribers -> Nullable<Int8>,
140         number_of_posts -> Nullable<Int8>,
141         number_of_comments -> Nullable<Int8>,
142         hot_rank -> Nullable<Int4>,
143     }
144 }
145
146 table! {
147     community_follower (id) {
148         id -> Int4,
149         community_id -> Int4,
150         user_id -> Int4,
151         published -> Timestamp,
152     }
153 }
154
155 table! {
156     community_moderator (id) {
157         id -> Int4,
158         community_id -> Int4,
159         user_id -> Int4,
160         published -> Timestamp,
161     }
162 }
163
164 table! {
165     community_user_ban (id) {
166         id -> Int4,
167         community_id -> Int4,
168         user_id -> Int4,
169         published -> Timestamp,
170     }
171 }
172
173 table! {
174     mod_add (id) {
175         id -> Int4,
176         mod_user_id -> Int4,
177         other_user_id -> Int4,
178         removed -> Nullable<Bool>,
179         when_ -> Timestamp,
180     }
181 }
182
183 table! {
184     mod_add_community (id) {
185         id -> Int4,
186         mod_user_id -> Int4,
187         other_user_id -> Int4,
188         community_id -> Int4,
189         removed -> Nullable<Bool>,
190         when_ -> Timestamp,
191     }
192 }
193
194 table! {
195     mod_ban (id) {
196         id -> Int4,
197         mod_user_id -> Int4,
198         other_user_id -> Int4,
199         reason -> Nullable<Text>,
200         banned -> Nullable<Bool>,
201         expires -> Nullable<Timestamp>,
202         when_ -> Timestamp,
203     }
204 }
205
206 table! {
207     mod_ban_from_community (id) {
208         id -> Int4,
209         mod_user_id -> Int4,
210         other_user_id -> Int4,
211         community_id -> Int4,
212         reason -> Nullable<Text>,
213         banned -> Nullable<Bool>,
214         expires -> Nullable<Timestamp>,
215         when_ -> Timestamp,
216     }
217 }
218
219 table! {
220     mod_lock_post (id) {
221         id -> Int4,
222         mod_user_id -> Int4,
223         post_id -> Int4,
224         locked -> Nullable<Bool>,
225         when_ -> Timestamp,
226     }
227 }
228
229 table! {
230     mod_remove_comment (id) {
231         id -> Int4,
232         mod_user_id -> Int4,
233         comment_id -> Int4,
234         reason -> Nullable<Text>,
235         removed -> Nullable<Bool>,
236         when_ -> Timestamp,
237     }
238 }
239
240 table! {
241     mod_remove_community (id) {
242         id -> Int4,
243         mod_user_id -> Int4,
244         community_id -> Int4,
245         reason -> Nullable<Text>,
246         removed -> Nullable<Bool>,
247         expires -> Nullable<Timestamp>,
248         when_ -> Timestamp,
249     }
250 }
251
252 table! {
253     mod_remove_post (id) {
254         id -> Int4,
255         mod_user_id -> Int4,
256         post_id -> Int4,
257         reason -> Nullable<Text>,
258         removed -> Nullable<Bool>,
259         when_ -> Timestamp,
260     }
261 }
262
263 table! {
264     mod_sticky_post (id) {
265         id -> Int4,
266         mod_user_id -> Int4,
267         post_id -> Int4,
268         stickied -> Nullable<Bool>,
269         when_ -> Timestamp,
270     }
271 }
272
273 table! {
274     password_reset_request (id) {
275         id -> Int4,
276         user_id -> Int4,
277         token_encrypted -> Text,
278         published -> Timestamp,
279     }
280 }
281
282 table! {
283     post (id) {
284         id -> Int4,
285         name -> Varchar,
286         url -> Nullable<Text>,
287         body -> Nullable<Text>,
288         creator_id -> Int4,
289         community_id -> Int4,
290         removed -> Bool,
291         locked -> Bool,
292         published -> Timestamp,
293         updated -> Nullable<Timestamp>,
294         deleted -> Bool,
295         nsfw -> Bool,
296         stickied -> Bool,
297         embed_title -> Nullable<Text>,
298         embed_description -> Nullable<Text>,
299         embed_html -> Nullable<Text>,
300         thumbnail_url -> Nullable<Text>,
301         ap_id -> Varchar,
302         local -> Bool,
303     }
304 }
305
306 table! {
307     post_aggregates_fast (id) {
308         id -> Int4,
309         name -> Nullable<Varchar>,
310         url -> Nullable<Text>,
311         body -> Nullable<Text>,
312         creator_id -> Nullable<Int4>,
313         community_id -> Nullable<Int4>,
314         removed -> Nullable<Bool>,
315         locked -> Nullable<Bool>,
316         published -> Nullable<Timestamp>,
317         updated -> Nullable<Timestamp>,
318         deleted -> Nullable<Bool>,
319         nsfw -> Nullable<Bool>,
320         stickied -> Nullable<Bool>,
321         embed_title -> Nullable<Text>,
322         embed_description -> Nullable<Text>,
323         embed_html -> Nullable<Text>,
324         thumbnail_url -> Nullable<Text>,
325         ap_id -> Nullable<Varchar>,
326         local -> Nullable<Bool>,
327         creator_actor_id -> Nullable<Varchar>,
328         creator_local -> Nullable<Bool>,
329         creator_name -> Nullable<Varchar>,
330         creator_preferred_username -> Nullable<Varchar>,
331         creator_published -> Nullable<Timestamp>,
332         creator_avatar -> Nullable<Text>,
333         banned -> Nullable<Bool>,
334         banned_from_community -> Nullable<Bool>,
335         community_actor_id -> Nullable<Varchar>,
336         community_local -> Nullable<Bool>,
337         community_name -> Nullable<Varchar>,
338         community_icon -> Nullable<Text>,
339         community_removed -> Nullable<Bool>,
340         community_deleted -> Nullable<Bool>,
341         community_nsfw -> Nullable<Bool>,
342         number_of_comments -> Nullable<Int8>,
343         score -> Nullable<Int8>,
344         upvotes -> Nullable<Int8>,
345         downvotes -> Nullable<Int8>,
346         hot_rank -> Nullable<Int4>,
347         hot_rank_active -> Nullable<Int4>,
348         newest_activity_time -> Nullable<Timestamp>,
349     }
350 }
351
352 table! {
353     post_like (id) {
354         id -> Int4,
355         post_id -> Int4,
356         user_id -> Int4,
357         score -> Int2,
358         published -> Timestamp,
359     }
360 }
361
362 table! {
363     post_read (id) {
364         id -> Int4,
365         post_id -> Int4,
366         user_id -> Int4,
367         published -> Timestamp,
368     }
369 }
370
371 table! {
372     post_saved (id) {
373         id -> Int4,
374         post_id -> Int4,
375         user_id -> Int4,
376         published -> Timestamp,
377     }
378 }
379
380 table! {
381     private_message (id) {
382         id -> Int4,
383         creator_id -> Int4,
384         recipient_id -> Int4,
385         content -> Text,
386         deleted -> Bool,
387         read -> Bool,
388         published -> Timestamp,
389         updated -> Nullable<Timestamp>,
390         ap_id -> Varchar,
391         local -> Bool,
392     }
393 }
394
395 table! {
396     site (id) {
397         id -> Int4,
398         name -> Varchar,
399         description -> Nullable<Text>,
400         creator_id -> Int4,
401         published -> Timestamp,
402         updated -> Nullable<Timestamp>,
403         enable_downvotes -> Bool,
404         open_registration -> Bool,
405         enable_nsfw -> Bool,
406         icon -> Nullable<Text>,
407         banner -> Nullable<Text>,
408     }
409 }
410
411 table! {
412     user_ (id) {
413         id -> Int4,
414         name -> Varchar,
415         preferred_username -> Nullable<Varchar>,
416         password_encrypted -> Text,
417         email -> Nullable<Text>,
418         avatar -> Nullable<Text>,
419         admin -> Bool,
420         banned -> Bool,
421         published -> Timestamp,
422         updated -> Nullable<Timestamp>,
423         show_nsfw -> Bool,
424         theme -> Varchar,
425         default_sort_type -> Int2,
426         default_listing_type -> Int2,
427         lang -> Varchar,
428         show_avatars -> Bool,
429         send_notifications_to_email -> Bool,
430         matrix_user_id -> Nullable<Text>,
431         actor_id -> Varchar,
432         bio -> Nullable<Text>,
433         local -> Bool,
434         private_key -> Nullable<Text>,
435         public_key -> Nullable<Text>,
436         last_refreshed_at -> Timestamp,
437         banner -> Nullable<Text>,
438     }
439 }
440
441 table! {
442     user_ban (id) {
443         id -> Int4,
444         user_id -> Int4,
445         published -> Timestamp,
446     }
447 }
448
449 table! {
450     user_fast (id) {
451         id -> Int4,
452         actor_id -> Nullable<Varchar>,
453         name -> Nullable<Varchar>,
454         preferred_username -> Nullable<Varchar>,
455         avatar -> Nullable<Text>,
456         banner -> Nullable<Text>,
457         email -> Nullable<Text>,
458         matrix_user_id -> Nullable<Text>,
459         bio -> Nullable<Text>,
460         local -> Nullable<Bool>,
461         admin -> Nullable<Bool>,
462         banned -> Nullable<Bool>,
463         show_avatars -> Nullable<Bool>,
464         send_notifications_to_email -> Nullable<Bool>,
465         published -> Nullable<Timestamp>,
466         number_of_posts -> Nullable<Int8>,
467         post_score -> Nullable<Int8>,
468         number_of_comments -> Nullable<Int8>,
469         comment_score -> Nullable<Int8>,
470     }
471 }
472
473 table! {
474     user_mention (id) {
475         id -> Int4,
476         recipient_id -> Int4,
477         comment_id -> Int4,
478         read -> Bool,
479         published -> Timestamp,
480     }
481 }
482
483 joinable!(activity -> user_ (user_id));
484 joinable!(comment -> post (post_id));
485 joinable!(comment -> user_ (creator_id));
486 joinable!(comment_like -> comment (comment_id));
487 joinable!(comment_like -> post (post_id));
488 joinable!(comment_like -> user_ (user_id));
489 joinable!(comment_saved -> comment (comment_id));
490 joinable!(comment_saved -> user_ (user_id));
491 joinable!(community -> category (category_id));
492 joinable!(community -> user_ (creator_id));
493 joinable!(community_follower -> community (community_id));
494 joinable!(community_follower -> user_ (user_id));
495 joinable!(community_moderator -> community (community_id));
496 joinable!(community_moderator -> user_ (user_id));
497 joinable!(community_user_ban -> community (community_id));
498 joinable!(community_user_ban -> user_ (user_id));
499 joinable!(mod_add_community -> community (community_id));
500 joinable!(mod_ban_from_community -> community (community_id));
501 joinable!(mod_lock_post -> post (post_id));
502 joinable!(mod_lock_post -> user_ (mod_user_id));
503 joinable!(mod_remove_comment -> comment (comment_id));
504 joinable!(mod_remove_comment -> user_ (mod_user_id));
505 joinable!(mod_remove_community -> community (community_id));
506 joinable!(mod_remove_community -> user_ (mod_user_id));
507 joinable!(mod_remove_post -> post (post_id));
508 joinable!(mod_remove_post -> user_ (mod_user_id));
509 joinable!(mod_sticky_post -> post (post_id));
510 joinable!(mod_sticky_post -> user_ (mod_user_id));
511 joinable!(password_reset_request -> user_ (user_id));
512 joinable!(post -> community (community_id));
513 joinable!(post -> user_ (creator_id));
514 joinable!(post_like -> post (post_id));
515 joinable!(post_like -> user_ (user_id));
516 joinable!(post_read -> post (post_id));
517 joinable!(post_read -> user_ (user_id));
518 joinable!(post_saved -> post (post_id));
519 joinable!(post_saved -> user_ (user_id));
520 joinable!(site -> user_ (creator_id));
521 joinable!(user_ban -> user_ (user_id));
522 joinable!(user_mention -> comment (comment_id));
523 joinable!(user_mention -> user_ (recipient_id));
524
525 allow_tables_to_appear_in_same_query!(
526     activity,
527     category,
528     comment,
529     comment_aggregates_fast,
530     comment_like,
531     comment_saved,
532     community,
533     community_aggregates_fast,
534     community_follower,
535     community_moderator,
536     community_user_ban,
537     mod_add,
538     mod_add_community,
539     mod_ban,
540     mod_ban_from_community,
541     mod_lock_post,
542     mod_remove_comment,
543     mod_remove_community,
544     mod_remove_post,
545     mod_sticky_post,
546     password_reset_request,
547     post,
548     post_aggregates_fast,
549     post_like,
550     post_read,
551     post_saved,
552     private_message,
553     site,
554     user_,
555     user_ban,
556     user_fast,
557     user_mention,
558 );