]> Untitled Git - lemmy.git/blob - server/src/schema.rs
Merge remote-tracking branch 'upstream/master'
[lemmy.git] / server / src / schema.rs
1 table! {
2     category (id) {
3         id -> Int4,
4         name -> Varchar,
5     }
6 }
7
8 table! {
9     comment (id) {
10         id -> Int4,
11         creator_id -> Int4,
12         post_id -> Int4,
13         parent_id -> Nullable<Int4>,
14         content -> Text,
15         removed -> Bool,
16         read -> Bool,
17         published -> Timestamp,
18         updated -> Nullable<Timestamp>,
19         deleted -> Bool,
20     }
21 }
22
23 table! {
24     comment_like (id) {
25         id -> Int4,
26         user_id -> Int4,
27         comment_id -> Int4,
28         post_id -> Int4,
29         score -> Int2,
30         published -> Timestamp,
31     }
32 }
33
34 table! {
35     comment_saved (id) {
36         id -> Int4,
37         comment_id -> Int4,
38         user_id -> Int4,
39         published -> Timestamp,
40     }
41 }
42
43 table! {
44     community (id) {
45         id -> Int4,
46         name -> Varchar,
47         title -> Varchar,
48         description -> Nullable<Text>,
49         category_id -> Int4,
50         creator_id -> Int4,
51         removed -> Bool,
52         published -> Timestamp,
53         updated -> Nullable<Timestamp>,
54         deleted -> Bool,
55         nsfw -> Bool,
56     }
57 }
58
59 table! {
60     community_follower (id) {
61         id -> Int4,
62         community_id -> Int4,
63         user_id -> Int4,
64         published -> Timestamp,
65     }
66 }
67
68 table! {
69     community_moderator (id) {
70         id -> Int4,
71         community_id -> Int4,
72         user_id -> Int4,
73         published -> Timestamp,
74     }
75 }
76
77 table! {
78     community_user_ban (id) {
79         id -> Int4,
80         community_id -> Int4,
81         user_id -> Int4,
82         published -> Timestamp,
83     }
84 }
85
86 table! {
87     mod_add (id) {
88         id -> Int4,
89         mod_user_id -> Int4,
90         other_user_id -> Int4,
91         removed -> Nullable<Bool>,
92         when_ -> Timestamp,
93     }
94 }
95
96 table! {
97     mod_add_community (id) {
98         id -> Int4,
99         mod_user_id -> Int4,
100         other_user_id -> Int4,
101         community_id -> Int4,
102         removed -> Nullable<Bool>,
103         when_ -> Timestamp,
104     }
105 }
106
107 table! {
108     mod_ban (id) {
109         id -> Int4,
110         mod_user_id -> Int4,
111         other_user_id -> Int4,
112         reason -> Nullable<Text>,
113         banned -> Nullable<Bool>,
114         expires -> Nullable<Timestamp>,
115         when_ -> Timestamp,
116     }
117 }
118
119 table! {
120     mod_ban_from_community (id) {
121         id -> Int4,
122         mod_user_id -> Int4,
123         other_user_id -> Int4,
124         community_id -> Int4,
125         reason -> Nullable<Text>,
126         banned -> Nullable<Bool>,
127         expires -> Nullable<Timestamp>,
128         when_ -> Timestamp,
129     }
130 }
131
132 table! {
133     mod_lock_post (id) {
134         id -> Int4,
135         mod_user_id -> Int4,
136         post_id -> Int4,
137         locked -> Nullable<Bool>,
138         when_ -> Timestamp,
139     }
140 }
141
142 table! {
143     mod_remove_comment (id) {
144         id -> Int4,
145         mod_user_id -> Int4,
146         comment_id -> Int4,
147         reason -> Nullable<Text>,
148         removed -> Nullable<Bool>,
149         when_ -> Timestamp,
150     }
151 }
152
153 table! {
154     mod_remove_community (id) {
155         id -> Int4,
156         mod_user_id -> Int4,
157         community_id -> Int4,
158         reason -> Nullable<Text>,
159         removed -> Nullable<Bool>,
160         expires -> Nullable<Timestamp>,
161         when_ -> Timestamp,
162     }
163 }
164
165 table! {
166     mod_remove_post (id) {
167         id -> Int4,
168         mod_user_id -> Int4,
169         post_id -> Int4,
170         reason -> Nullable<Text>,
171         removed -> Nullable<Bool>,
172         when_ -> Timestamp,
173     }
174 }
175
176 table! {
177     mod_sticky_post (id) {
178         id -> Int4,
179         mod_user_id -> Int4,
180         post_id -> Int4,
181         stickied -> Nullable<Bool>,
182         when_ -> Timestamp,
183     }
184 }
185
186 table! {
187     password_reset_request (id) {
188         id -> Int4,
189         user_id -> Int4,
190         token_encrypted -> Text,
191         published -> Timestamp,
192     }
193 }
194
195 table! {
196     post (id) {
197         id -> Int4,
198         name -> Varchar,
199         url -> Nullable<Text>,
200         body -> Nullable<Text>,
201         creator_id -> Int4,
202         community_id -> Int4,
203         removed -> Bool,
204         locked -> Bool,
205         published -> Timestamp,
206         updated -> Nullable<Timestamp>,
207         deleted -> Bool,
208         nsfw -> Bool,
209         stickied -> Bool,
210     }
211 }
212
213 table! {
214     post_like (id) {
215         id -> Int4,
216         post_id -> Int4,
217         user_id -> Int4,
218         score -> Int2,
219         published -> Timestamp,
220     }
221 }
222
223 table! {
224     post_read (id) {
225         id -> Int4,
226         post_id -> Int4,
227         user_id -> Int4,
228         published -> Timestamp,
229     }
230 }
231
232 table! {
233     post_saved (id) {
234         id -> Int4,
235         post_id -> Int4,
236         user_id -> Int4,
237         published -> Timestamp,
238     }
239 }
240
241 table! {
242     private_message (id) {
243         id -> Int4,
244         creator_id -> Int4,
245         recipient_id -> Int4,
246         content -> Text,
247         deleted -> Bool,
248         read -> Bool,
249         published -> Timestamp,
250         updated -> Nullable<Timestamp>,
251     }
252 }
253
254 table! {
255     site (id) {
256         id -> Int4,
257         name -> Varchar,
258         description -> Nullable<Text>,
259         creator_id -> Int4,
260         published -> Timestamp,
261         updated -> Nullable<Timestamp>,
262         enable_downvotes -> Bool,
263         open_registration -> Bool,
264         enable_nsfw -> Bool,
265     }
266 }
267
268 table! {
269     user_ (id) {
270         id -> Int4,
271         name -> Varchar,
272         fedi_name -> Varchar,
273         preferred_username -> Nullable<Varchar>,
274         password_encrypted -> Text,
275         email -> Nullable<Text>,
276         avatar -> Nullable<Text>,
277         admin -> Bool,
278         banned -> Bool,
279         published -> Timestamp,
280         updated -> Nullable<Timestamp>,
281         show_nsfw -> Bool,
282         theme -> Varchar,
283         default_sort_type -> Int2,
284         default_listing_type -> Int2,
285         lang -> Varchar,
286         show_avatars -> Bool,
287         send_notifications_to_email -> Bool,
288         matrix_user_id -> Nullable<Text>,
289     }
290 }
291
292 table! {
293     user_ban (id) {
294         id -> Int4,
295         user_id -> Int4,
296         published -> Timestamp,
297     }
298 }
299
300 table! {
301     user_mention (id) {
302         id -> Int4,
303         recipient_id -> Int4,
304         comment_id -> Int4,
305         read -> Bool,
306         published -> Timestamp,
307     }
308 }
309
310 joinable!(comment -> post (post_id));
311 joinable!(comment -> user_ (creator_id));
312 joinable!(comment_like -> comment (comment_id));
313 joinable!(comment_like -> post (post_id));
314 joinable!(comment_like -> user_ (user_id));
315 joinable!(comment_saved -> comment (comment_id));
316 joinable!(comment_saved -> user_ (user_id));
317 joinable!(community -> category (category_id));
318 joinable!(community -> user_ (creator_id));
319 joinable!(community_follower -> community (community_id));
320 joinable!(community_follower -> user_ (user_id));
321 joinable!(community_moderator -> community (community_id));
322 joinable!(community_moderator -> user_ (user_id));
323 joinable!(community_user_ban -> community (community_id));
324 joinable!(community_user_ban -> user_ (user_id));
325 joinable!(mod_add_community -> community (community_id));
326 joinable!(mod_ban_from_community -> community (community_id));
327 joinable!(mod_lock_post -> post (post_id));
328 joinable!(mod_lock_post -> user_ (mod_user_id));
329 joinable!(mod_remove_comment -> comment (comment_id));
330 joinable!(mod_remove_comment -> user_ (mod_user_id));
331 joinable!(mod_remove_community -> community (community_id));
332 joinable!(mod_remove_community -> user_ (mod_user_id));
333 joinable!(mod_remove_post -> post (post_id));
334 joinable!(mod_remove_post -> user_ (mod_user_id));
335 joinable!(mod_sticky_post -> post (post_id));
336 joinable!(mod_sticky_post -> user_ (mod_user_id));
337 joinable!(password_reset_request -> user_ (user_id));
338 joinable!(post -> community (community_id));
339 joinable!(post -> user_ (creator_id));
340 joinable!(post_like -> post (post_id));
341 joinable!(post_like -> user_ (user_id));
342 joinable!(post_read -> post (post_id));
343 joinable!(post_read -> user_ (user_id));
344 joinable!(post_saved -> post (post_id));
345 joinable!(post_saved -> user_ (user_id));
346 joinable!(site -> user_ (creator_id));
347 joinable!(user_ban -> user_ (user_id));
348 joinable!(user_mention -> comment (comment_id));
349 joinable!(user_mention -> user_ (recipient_id));
350
351 allow_tables_to_appear_in_same_query!(
352   category,
353   comment,
354   comment_like,
355   comment_saved,
356   community,
357   community_follower,
358   community_moderator,
359   community_user_ban,
360   mod_add,
361   mod_add_community,
362   mod_ban,
363   mod_ban_from_community,
364   mod_lock_post,
365   mod_remove_comment,
366   mod_remove_community,
367   mod_remove_post,
368   mod_sticky_post,
369   password_reset_request,
370   post,
371   post_like,
372   post_read,
373   post_saved,
374   private_message,
375   site,
376   user_,
377   user_ban,
378   user_mention,
379 );