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