]> Untitled Git - lemmy.git/blob - server/src/schema.rs
Merge branch 'admin_settings' into dev
[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         embed_title -> Nullable<Text>,
211         embed_description -> Nullable<Text>,
212         embed_html -> Nullable<Text>,
213         thumbnail_url -> Nullable<Text>,
214     }
215 }
216
217 table! {
218     post_like (id) {
219         id -> Int4,
220         post_id -> Int4,
221         user_id -> Int4,
222         score -> Int2,
223         published -> Timestamp,
224     }
225 }
226
227 table! {
228     post_read (id) {
229         id -> Int4,
230         post_id -> Int4,
231         user_id -> Int4,
232         published -> Timestamp,
233     }
234 }
235
236 table! {
237     post_saved (id) {
238         id -> Int4,
239         post_id -> Int4,
240         user_id -> Int4,
241         published -> Timestamp,
242     }
243 }
244
245 table! {
246     private_message (id) {
247         id -> Int4,
248         creator_id -> Int4,
249         recipient_id -> Int4,
250         content -> Text,
251         deleted -> Bool,
252         read -> Bool,
253         published -> Timestamp,
254         updated -> Nullable<Timestamp>,
255     }
256 }
257
258 table! {
259     site (id) {
260         id -> Int4,
261         name -> Varchar,
262         description -> Nullable<Text>,
263         creator_id -> Int4,
264         published -> Timestamp,
265         updated -> Nullable<Timestamp>,
266         enable_downvotes -> Bool,
267         open_registration -> Bool,
268         enable_nsfw -> Bool,
269     }
270 }
271
272 table! {
273     user_ (id) {
274         id -> Int4,
275         name -> Varchar,
276         fedi_name -> Varchar,
277         preferred_username -> Nullable<Varchar>,
278         password_encrypted -> Text,
279         email -> Nullable<Text>,
280         avatar -> Nullable<Text>,
281         admin -> Bool,
282         banned -> Bool,
283         published -> Timestamp,
284         updated -> Nullable<Timestamp>,
285         show_nsfw -> Bool,
286         theme -> Varchar,
287         default_sort_type -> Int2,
288         default_listing_type -> Int2,
289         lang -> Varchar,
290         show_avatars -> Bool,
291         send_notifications_to_email -> Bool,
292         matrix_user_id -> Nullable<Text>,
293     }
294 }
295
296 table! {
297     user_ban (id) {
298         id -> Int4,
299         user_id -> Int4,
300         published -> Timestamp,
301     }
302 }
303
304 table! {
305     user_mention (id) {
306         id -> Int4,
307         recipient_id -> Int4,
308         comment_id -> Int4,
309         read -> Bool,
310         published -> Timestamp,
311     }
312 }
313
314 joinable!(comment -> post (post_id));
315 joinable!(comment -> user_ (creator_id));
316 joinable!(comment_like -> comment (comment_id));
317 joinable!(comment_like -> post (post_id));
318 joinable!(comment_like -> user_ (user_id));
319 joinable!(comment_saved -> comment (comment_id));
320 joinable!(comment_saved -> user_ (user_id));
321 joinable!(community -> category (category_id));
322 joinable!(community -> user_ (creator_id));
323 joinable!(community_follower -> community (community_id));
324 joinable!(community_follower -> user_ (user_id));
325 joinable!(community_moderator -> community (community_id));
326 joinable!(community_moderator -> user_ (user_id));
327 joinable!(community_user_ban -> community (community_id));
328 joinable!(community_user_ban -> user_ (user_id));
329 joinable!(mod_add_community -> community (community_id));
330 joinable!(mod_ban_from_community -> community (community_id));
331 joinable!(mod_lock_post -> post (post_id));
332 joinable!(mod_lock_post -> user_ (mod_user_id));
333 joinable!(mod_remove_comment -> comment (comment_id));
334 joinable!(mod_remove_comment -> user_ (mod_user_id));
335 joinable!(mod_remove_community -> community (community_id));
336 joinable!(mod_remove_community -> user_ (mod_user_id));
337 joinable!(mod_remove_post -> post (post_id));
338 joinable!(mod_remove_post -> user_ (mod_user_id));
339 joinable!(mod_sticky_post -> post (post_id));
340 joinable!(mod_sticky_post -> user_ (mod_user_id));
341 joinable!(password_reset_request -> user_ (user_id));
342 joinable!(post -> community (community_id));
343 joinable!(post -> user_ (creator_id));
344 joinable!(post_like -> post (post_id));
345 joinable!(post_like -> user_ (user_id));
346 joinable!(post_read -> post (post_id));
347 joinable!(post_read -> user_ (user_id));
348 joinable!(post_saved -> post (post_id));
349 joinable!(post_saved -> user_ (user_id));
350 joinable!(site -> user_ (creator_id));
351 joinable!(user_ban -> user_ (user_id));
352 joinable!(user_mention -> comment (comment_id));
353 joinable!(user_mention -> user_ (recipient_id));
354
355 allow_tables_to_appear_in_same_query!(
356   category,
357   comment,
358   comment_like,
359   comment_saved,
360   community,
361   community_follower,
362   community_moderator,
363   community_user_ban,
364   mod_add,
365   mod_add_community,
366   mod_ban,
367   mod_ban_from_community,
368   mod_lock_post,
369   mod_remove_comment,
370   mod_remove_community,
371   mod_remove_post,
372   mod_sticky_post,
373   password_reset_request,
374   post,
375   post_like,
376   post_read,
377   post_saved,
378   private_message,
379   site,
380   user_,
381   user_ban,
382   user_mention,
383 );