]> Untitled Git - lemmy.git/blob - lemmy_db/src/schema.rs
In activity table, remove `user_id` and add `sensitive` (#127)
[lemmy.git] / lemmy_db / src / schema.rs
1 table! {
2     activity (id) {
3         id -> Int4,
4         ap_id -> Text,
5         data -> Jsonb,
6         local -> Bool,
7         sensitive -> Bool,
8         published -> Timestamp,
9         updated -> Nullable<Timestamp>,
10     }
11 }
12
13 table! {
14     category (id) {
15         id -> Int4,
16         name -> Varchar,
17     }
18 }
19
20 table! {
21     comment (id) {
22         id -> Int4,
23         creator_id -> Int4,
24         post_id -> Int4,
25         parent_id -> Nullable<Int4>,
26         content -> Text,
27         removed -> Bool,
28         read -> Bool,
29         published -> Timestamp,
30         updated -> Nullable<Timestamp>,
31         deleted -> Bool,
32         ap_id -> Varchar,
33         local -> Bool,
34     }
35 }
36
37 table! {
38     comment_aggregates_fast (id) {
39         id -> Int4,
40         creator_id -> Nullable<Int4>,
41         post_id -> Nullable<Int4>,
42         parent_id -> Nullable<Int4>,
43         content -> Nullable<Text>,
44         removed -> Nullable<Bool>,
45         read -> Nullable<Bool>,
46         published -> Nullable<Timestamp>,
47         updated -> Nullable<Timestamp>,
48         deleted -> Nullable<Bool>,
49         ap_id -> Nullable<Varchar>,
50         local -> Nullable<Bool>,
51         post_name -> Nullable<Varchar>,
52         community_id -> Nullable<Int4>,
53         community_actor_id -> Nullable<Varchar>,
54         community_local -> Nullable<Bool>,
55         community_name -> Nullable<Varchar>,
56         community_icon -> Nullable<Text>,
57         banned -> Nullable<Bool>,
58         banned_from_community -> Nullable<Bool>,
59         creator_actor_id -> Nullable<Varchar>,
60         creator_local -> Nullable<Bool>,
61         creator_name -> Nullable<Varchar>,
62         creator_preferred_username -> Nullable<Varchar>,
63         creator_published -> Nullable<Timestamp>,
64         creator_avatar -> Nullable<Text>,
65         score -> Nullable<Int8>,
66         upvotes -> Nullable<Int8>,
67         downvotes -> Nullable<Int8>,
68         hot_rank -> Nullable<Int4>,
69         hot_rank_active -> Nullable<Int4>,
70     }
71 }
72
73 table! {
74     comment_like (id) {
75         id -> Int4,
76         user_id -> Int4,
77         comment_id -> Int4,
78         post_id -> Int4,
79         score -> Int2,
80         published -> Timestamp,
81     }
82 }
83
84 table! {
85     comment_saved (id) {
86         id -> Int4,
87         comment_id -> Int4,
88         user_id -> Int4,
89         published -> Timestamp,
90     }
91 }
92
93 table! {
94     community (id) {
95         id -> Int4,
96         name -> Varchar,
97         title -> Varchar,
98         description -> Nullable<Text>,
99         category_id -> Int4,
100         creator_id -> Int4,
101         removed -> Bool,
102         published -> Timestamp,
103         updated -> Nullable<Timestamp>,
104         deleted -> Bool,
105         nsfw -> Bool,
106         actor_id -> Varchar,
107         local -> Bool,
108         private_key -> Nullable<Text>,
109         public_key -> Nullable<Text>,
110         last_refreshed_at -> Timestamp,
111         icon -> Nullable<Text>,
112         banner -> Nullable<Text>,
113     }
114 }
115
116 table! {
117     community_aggregates_fast (id) {
118         id -> Int4,
119         name -> Nullable<Varchar>,
120         title -> Nullable<Varchar>,
121         icon -> Nullable<Text>,
122         banner -> Nullable<Text>,
123         description -> Nullable<Text>,
124         category_id -> Nullable<Int4>,
125         creator_id -> Nullable<Int4>,
126         removed -> Nullable<Bool>,
127         published -> Nullable<Timestamp>,
128         updated -> Nullable<Timestamp>,
129         deleted -> Nullable<Bool>,
130         nsfw -> Nullable<Bool>,
131         actor_id -> Nullable<Varchar>,
132         local -> Nullable<Bool>,
133         last_refreshed_at -> Nullable<Timestamp>,
134         creator_actor_id -> Nullable<Varchar>,
135         creator_local -> Nullable<Bool>,
136         creator_name -> Nullable<Varchar>,
137         creator_preferred_username -> Nullable<Varchar>,
138         creator_avatar -> Nullable<Text>,
139         category_name -> Nullable<Varchar>,
140         number_of_subscribers -> Nullable<Int8>,
141         number_of_posts -> Nullable<Int8>,
142         number_of_comments -> Nullable<Int8>,
143         hot_rank -> Nullable<Int4>,
144     }
145 }
146
147 table! {
148     community_follower (id) {
149         id -> Int4,
150         community_id -> Int4,
151         user_id -> Int4,
152         published -> Timestamp,
153     }
154 }
155
156 table! {
157     community_moderator (id) {
158         id -> Int4,
159         community_id -> Int4,
160         user_id -> Int4,
161         published -> Timestamp,
162     }
163 }
164
165 table! {
166     community_user_ban (id) {
167         id -> Int4,
168         community_id -> Int4,
169         user_id -> Int4,
170         published -> Timestamp,
171     }
172 }
173
174 table! {
175     mod_add (id) {
176         id -> Int4,
177         mod_user_id -> Int4,
178         other_user_id -> Int4,
179         removed -> Nullable<Bool>,
180         when_ -> Timestamp,
181     }
182 }
183
184 table! {
185     mod_add_community (id) {
186         id -> Int4,
187         mod_user_id -> Int4,
188         other_user_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_user_id -> Int4,
199         other_user_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_user_id -> Int4,
211         other_user_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_user_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_user_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_user_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_user_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_user_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         user_id -> Int4,
278         token_encrypted -> Text,
279         published -> Timestamp,
280     }
281 }
282
283 table! {
284     post (id) {
285         id -> Int4,
286         name -> Varchar,
287         url -> Nullable<Text>,
288         body -> Nullable<Text>,
289         creator_id -> Int4,
290         community_id -> Int4,
291         removed -> Bool,
292         locked -> Bool,
293         published -> Timestamp,
294         updated -> Nullable<Timestamp>,
295         deleted -> Bool,
296         nsfw -> Bool,
297         stickied -> Bool,
298         embed_title -> Nullable<Text>,
299         embed_description -> Nullable<Text>,
300         embed_html -> Nullable<Text>,
301         thumbnail_url -> Nullable<Text>,
302         ap_id -> Varchar,
303         local -> Bool,
304     }
305 }
306
307 table! {
308     post_aggregates_fast (id) {
309         id -> Int4,
310         name -> Nullable<Varchar>,
311         url -> Nullable<Text>,
312         body -> Nullable<Text>,
313         creator_id -> Nullable<Int4>,
314         community_id -> Nullable<Int4>,
315         removed -> Nullable<Bool>,
316         locked -> Nullable<Bool>,
317         published -> Nullable<Timestamp>,
318         updated -> Nullable<Timestamp>,
319         deleted -> Nullable<Bool>,
320         nsfw -> Nullable<Bool>,
321         stickied -> Nullable<Bool>,
322         embed_title -> Nullable<Text>,
323         embed_description -> Nullable<Text>,
324         embed_html -> Nullable<Text>,
325         thumbnail_url -> Nullable<Text>,
326         ap_id -> Nullable<Varchar>,
327         local -> Nullable<Bool>,
328         creator_actor_id -> Nullable<Varchar>,
329         creator_local -> Nullable<Bool>,
330         creator_name -> Nullable<Varchar>,
331         creator_preferred_username -> Nullable<Varchar>,
332         creator_published -> Nullable<Timestamp>,
333         creator_avatar -> Nullable<Text>,
334         banned -> Nullable<Bool>,
335         banned_from_community -> Nullable<Bool>,
336         community_actor_id -> Nullable<Varchar>,
337         community_local -> Nullable<Bool>,
338         community_name -> Nullable<Varchar>,
339         community_icon -> Nullable<Text>,
340         community_removed -> Nullable<Bool>,
341         community_deleted -> Nullable<Bool>,
342         community_nsfw -> Nullable<Bool>,
343         number_of_comments -> Nullable<Int8>,
344         score -> Nullable<Int8>,
345         upvotes -> Nullable<Int8>,
346         downvotes -> Nullable<Int8>,
347         hot_rank -> Nullable<Int4>,
348         hot_rank_active -> Nullable<Int4>,
349         newest_activity_time -> Nullable<Timestamp>,
350     }
351 }
352
353 table! {
354     post_like (id) {
355         id -> Int4,
356         post_id -> Int4,
357         user_id -> Int4,
358         score -> Int2,
359         published -> Timestamp,
360     }
361 }
362
363 table! {
364     post_read (id) {
365         id -> Int4,
366         post_id -> Int4,
367         user_id -> Int4,
368         published -> Timestamp,
369     }
370 }
371
372 table! {
373     post_saved (id) {
374         id -> Int4,
375         post_id -> Int4,
376         user_id -> Int4,
377         published -> Timestamp,
378     }
379 }
380
381 table! {
382     private_message (id) {
383         id -> Int4,
384         creator_id -> Int4,
385         recipient_id -> Int4,
386         content -> Text,
387         deleted -> Bool,
388         read -> Bool,
389         published -> Timestamp,
390         updated -> Nullable<Timestamp>,
391         ap_id -> Varchar,
392         local -> Bool,
393     }
394 }
395
396 table! {
397     site (id) {
398         id -> Int4,
399         name -> Varchar,
400         description -> Nullable<Text>,
401         creator_id -> Int4,
402         published -> Timestamp,
403         updated -> Nullable<Timestamp>,
404         enable_downvotes -> Bool,
405         open_registration -> Bool,
406         enable_nsfw -> Bool,
407         icon -> Nullable<Text>,
408         banner -> Nullable<Text>,
409     }
410 }
411
412 table! {
413     user_ (id) {
414         id -> Int4,
415         name -> Varchar,
416         preferred_username -> Nullable<Varchar>,
417         password_encrypted -> Text,
418         email -> Nullable<Text>,
419         avatar -> Nullable<Text>,
420         admin -> Bool,
421         banned -> Bool,
422         published -> Timestamp,
423         updated -> Nullable<Timestamp>,
424         show_nsfw -> Bool,
425         theme -> Varchar,
426         default_sort_type -> Int2,
427         default_listing_type -> Int2,
428         lang -> Varchar,
429         show_avatars -> Bool,
430         send_notifications_to_email -> Bool,
431         matrix_user_id -> Nullable<Text>,
432         actor_id -> Varchar,
433         bio -> Nullable<Text>,
434         local -> Bool,
435         private_key -> Nullable<Text>,
436         public_key -> Nullable<Text>,
437         last_refreshed_at -> Timestamp,
438         banner -> Nullable<Text>,
439     }
440 }
441
442 table! {
443     user_ban (id) {
444         id -> Int4,
445         user_id -> Int4,
446         published -> Timestamp,
447     }
448 }
449
450 table! {
451     user_fast (id) {
452         id -> Int4,
453         actor_id -> Nullable<Varchar>,
454         name -> Nullable<Varchar>,
455         preferred_username -> Nullable<Varchar>,
456         avatar -> Nullable<Text>,
457         banner -> Nullable<Text>,
458         email -> Nullable<Text>,
459         matrix_user_id -> Nullable<Text>,
460         bio -> Nullable<Text>,
461         local -> Nullable<Bool>,
462         admin -> Nullable<Bool>,
463         banned -> Nullable<Bool>,
464         show_avatars -> Nullable<Bool>,
465         send_notifications_to_email -> Nullable<Bool>,
466         published -> Nullable<Timestamp>,
467         number_of_posts -> Nullable<Int8>,
468         post_score -> Nullable<Int8>,
469         number_of_comments -> Nullable<Int8>,
470         comment_score -> Nullable<Int8>,
471     }
472 }
473
474 table! {
475     user_mention (id) {
476         id -> Int4,
477         recipient_id -> Int4,
478         comment_id -> Int4,
479         read -> Bool,
480         published -> Timestamp,
481     }
482 }
483
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 );