-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
781 lines (523 loc) · 18.1 KB
/
schema.sql
File metadata and controls
781 lines (523 loc) · 18.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.13 (Debian 15.13-1.pgdg120+1)
-- Dumped by pg_dump version 15.6
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: attempts; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.attempts (
id bigint NOT NULL,
created_at timestamp with time zone,
quiz_id bigint,
user_id bigint
);
ALTER TABLE public.attempts OWNER TO appuser;
--
-- Name: bots; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.bots (
id bigint NOT NULL,
created_at timestamp with time zone,
owner_id bigint,
assistant_id text,
name text,
description text,
published boolean DEFAULT false
);
ALTER TABLE public.bots OWNER TO appuser;
--
-- Name: codes; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.codes (
id bigint NOT NULL,
created_at timestamp with time zone,
code text,
nonce text,
email text
);
ALTER TABLE public.codes OWNER TO appuser;
--
-- Name: deliveries; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.deliveries (
id bigint NOT NULL,
created_at timestamp with time zone,
message_id bigint,
room_id bigint,
recipient_id bigint,
sender_id bigint,
sent_at timestamp with time zone
);
ALTER TABLE public.deliveries OWNER TO appuser;
--
-- Name: friends; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.friends (
id bigint NOT NULL,
created_at timestamp with time zone,
a_id bigint,
b_id bigint,
b_role text
);
ALTER TABLE public.friends OWNER TO appuser;
--
-- Name: gradients; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.gradients (
id bigint NOT NULL,
created_at text,
user_id bigint,
gradient bytea
);
ALTER TABLE public.gradients OWNER TO appuser;
--
-- Name: images; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.images (
id bigint NOT NULL,
created_at timestamp with time zone,
url text,
user_id bigint
);
ALTER TABLE public.images OWNER TO appuser;
--
-- Name: kids_codes; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.kids_codes (
id bigint NOT NULL,
created_at timestamp with time zone,
code text,
nonce text,
user_id bigint
);
ALTER TABLE public.kids_codes OWNER TO appuser;
--
-- Name: kids_parents; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.kids_parents (
id bigint NOT NULL,
created_at timestamp with time zone,
kid_id bigint,
parent_id bigint
);
ALTER TABLE public.kids_parents OWNER TO appuser;
--
-- Name: messages; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.messages (
id bigint NOT NULL,
created_at timestamp with time zone,
sender_id bigint,
room_id bigint,
body text
);
ALTER TABLE public.messages OWNER TO appuser;
--
-- Name: migration_version; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.migration_version (
version bigint
);
ALTER TABLE public.migration_version OWNER TO appuser;
--
-- Name: notes; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.notes (
id bigint NOT NULL,
created_at timestamp with time zone,
owner_id bigint,
body text,
published boolean DEFAULT false
);
ALTER TABLE public.notes OWNER TO appuser;
--
-- Name: postcards; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.postcards (
id bigint NOT NULL,
created_at timestamp with time zone,
sender bigint,
recipient bigint,
subject text,
body text,
state text DEFAULT 'draft'::text
);
ALTER TABLE public.postcards OWNER TO appuser;
--
-- Name: questions; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.questions (
id bigint NOT NULL,
created_at text,
quiz_id bigint,
text text,
answer text
);
ALTER TABLE public.questions OWNER TO appuser;
--
-- Name: quizzes; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.quizzes (
id bigint NOT NULL,
created_at timestamp with time zone,
name text,
description text,
published boolean DEFAULT false
);
ALTER TABLE public.quizzes OWNER TO appuser;
--
-- Name: responses; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.responses (
id bigint NOT NULL,
created_at timestamp with time zone,
quiz_id bigint,
user_id bigint,
attempt_id bigint,
question_id bigint,
text text
);
ALTER TABLE public.responses OWNER TO appuser;
--
-- Name: room_users; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.room_users (
id bigint NOT NULL,
created_at timestamp with time zone,
room_id bigint,
user_id bigint
);
ALTER TABLE public.room_users OWNER TO appuser;
--
-- Name: rooms; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.rooms (
id bigint NOT NULL,
created_at timestamp with time zone,
key text
);
ALTER TABLE public.rooms OWNER TO appuser;
--
-- Name: sessions; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.sessions (
id bigint NOT NULL,
user_id bigint,
key text
);
ALTER TABLE public.sessions OWNER TO appuser;
--
-- Name: threads; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.threads (
id bigint NOT NULL,
created_at timestamp with time zone,
thread_id text,
assistant_id text,
user_id bigint
);
ALTER TABLE public.threads OWNER TO appuser;
--
-- Name: users; Type: TABLE; Schema: public; Owner: appuser
--
CREATE TABLE public.users (
id bigint NOT NULL,
created_at timestamp with time zone,
username text,
email text,
avatar_url text DEFAULT 'https://www.gravatar.com/avatar/?d=mp'::text,
is_parent boolean DEFAULT false,
bio text DEFAULT ''::text,
become_user_id bigint,
admin boolean DEFAULT false
);
ALTER TABLE public.users OWNER TO appuser;
--
-- Name: codes idx_16393_codes_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.codes
ADD CONSTRAINT idx_16393_codes_pkey PRIMARY KEY (id);
--
-- Name: sessions idx_16398_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.sessions
ADD CONSTRAINT idx_16398_sessions_pkey PRIMARY KEY (id);
--
-- Name: kids_codes idx_16403_kids_codes_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.kids_codes
ADD CONSTRAINT idx_16403_kids_codes_pkey PRIMARY KEY (id);
--
-- Name: kids_parents idx_16408_kids_parents_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.kids_parents
ADD CONSTRAINT idx_16408_kids_parents_pkey PRIMARY KEY (id);
--
-- Name: gradients idx_16411_gradients_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.gradients
ADD CONSTRAINT idx_16411_gradients_pkey PRIMARY KEY (id);
--
-- Name: rooms idx_16416_rooms_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.rooms
ADD CONSTRAINT idx_16416_rooms_pkey PRIMARY KEY (id);
--
-- Name: messages idx_16421_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.messages
ADD CONSTRAINT idx_16421_messages_pkey PRIMARY KEY (id);
--
-- Name: room_users idx_16426_room_users_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.room_users
ADD CONSTRAINT idx_16426_room_users_pkey PRIMARY KEY (id);
--
-- Name: deliveries idx_16429_deliveries_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.deliveries
ADD CONSTRAINT idx_16429_deliveries_pkey PRIMARY KEY (id);
--
-- Name: friends idx_16432_friends_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.friends
ADD CONSTRAINT idx_16432_friends_pkey PRIMARY KEY (id);
--
-- Name: images idx_16437_images_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.images
ADD CONSTRAINT idx_16437_images_pkey PRIMARY KEY (id);
--
-- Name: responses idx_16442_responses_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.responses
ADD CONSTRAINT idx_16442_responses_pkey PRIMARY KEY (id);
--
-- Name: questions idx_16447_questions_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.questions
ADD CONSTRAINT idx_16447_questions_pkey PRIMARY KEY (id);
--
-- Name: attempts idx_16452_attempts_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.attempts
ADD CONSTRAINT idx_16452_attempts_pkey PRIMARY KEY (id);
--
-- Name: users idx_16455_users_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT idx_16455_users_pkey PRIMARY KEY (id);
--
-- Name: quizzes idx_16464_quizzes_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.quizzes
ADD CONSTRAINT idx_16464_quizzes_pkey PRIMARY KEY (id);
--
-- Name: postcards idx_16470_postcards_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.postcards
ADD CONSTRAINT idx_16470_postcards_pkey PRIMARY KEY (id);
--
-- Name: threads idx_16476_threads_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.threads
ADD CONSTRAINT idx_16476_threads_pkey PRIMARY KEY (id);
--
-- Name: bots idx_16481_bots_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.bots
ADD CONSTRAINT idx_16481_bots_pkey PRIMARY KEY (id);
--
-- Name: notes idx_16487_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.notes
ADD CONSTRAINT idx_16487_notes_pkey PRIMARY KEY (id);
--
-- Name: idx_16398_sqlite_autoindex_sessions_1; Type: INDEX; Schema: public; Owner: appuser
--
CREATE UNIQUE INDEX idx_16398_sqlite_autoindex_sessions_1 ON public.sessions USING btree (key);
--
-- Name: idx_16426_sqlite_autoindex_room_users_1; Type: INDEX; Schema: public; Owner: appuser
--
CREATE UNIQUE INDEX idx_16426_sqlite_autoindex_room_users_1 ON public.room_users USING btree (room_id, user_id);
--
-- Name: idx_16429_sqlite_autoindex_deliveries_1; Type: INDEX; Schema: public; Owner: appuser
--
CREATE UNIQUE INDEX idx_16429_sqlite_autoindex_deliveries_1 ON public.deliveries USING btree (message_id, recipient_id);
--
-- Name: idx_16432_uidx_friends_a_b; Type: INDEX; Schema: public; Owner: appuser
--
CREATE UNIQUE INDEX idx_16432_uidx_friends_a_b ON public.friends USING btree (a_id, b_id);
--
-- Name: idx_16442_sqlite_autoindex_responses_1; Type: INDEX; Schema: public; Owner: appuser
--
CREATE UNIQUE INDEX idx_16442_sqlite_autoindex_responses_1 ON public.responses USING btree (attempt_id, question_id);
--
-- Name: idx_16455_sqlite_autoindex_users_1; Type: INDEX; Schema: public; Owner: appuser
--
CREATE UNIQUE INDEX idx_16455_sqlite_autoindex_users_1 ON public.users USING btree (username);
--
-- Name: idx_16455_sqlite_autoindex_users_2; Type: INDEX; Schema: public; Owner: appuser
--
CREATE UNIQUE INDEX idx_16455_sqlite_autoindex_users_2 ON public.users USING btree (email);
--
-- Name: attempts attempts_quiz_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.attempts
ADD CONSTRAINT attempts_quiz_id_fkey FOREIGN KEY (quiz_id) REFERENCES public.quizzes(id);
--
-- Name: attempts attempts_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.attempts
ADD CONSTRAINT attempts_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: bots bots_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.bots
ADD CONSTRAINT bots_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES public.users(id);
--
-- Name: deliveries deliveries_message_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.deliveries
ADD CONSTRAINT deliveries_message_id_fkey FOREIGN KEY (message_id) REFERENCES public.messages(id);
--
-- Name: deliveries deliveries_recipient_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.deliveries
ADD CONSTRAINT deliveries_recipient_id_fkey FOREIGN KEY (recipient_id) REFERENCES public.users(id);
--
-- Name: deliveries deliveries_room_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.deliveries
ADD CONSTRAINT deliveries_room_id_fkey FOREIGN KEY (room_id) REFERENCES public.rooms(id);
--
-- Name: deliveries deliveries_sender_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.deliveries
ADD CONSTRAINT deliveries_sender_id_fkey FOREIGN KEY (sender_id) REFERENCES public.users(id);
--
-- Name: friends friends_a_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.friends
ADD CONSTRAINT friends_a_id_fkey FOREIGN KEY (a_id) REFERENCES public.users(id) ON DELETE CASCADE;
--
-- Name: friends friends_b_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.friends
ADD CONSTRAINT friends_b_id_fkey FOREIGN KEY (b_id) REFERENCES public.users(id) ON DELETE CASCADE;
--
-- Name: gradients gradients_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.gradients
ADD CONSTRAINT gradients_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: images images_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.images
ADD CONSTRAINT images_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: kids_codes kids_codes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.kids_codes
ADD CONSTRAINT kids_codes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: kids_parents kids_parents_kid_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.kids_parents
ADD CONSTRAINT kids_parents_kid_id_fkey FOREIGN KEY (kid_id) REFERENCES public.users(id);
--
-- Name: kids_parents kids_parents_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.kids_parents
ADD CONSTRAINT kids_parents_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.users(id);
--
-- Name: messages messages_room_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.messages
ADD CONSTRAINT messages_room_id_fkey FOREIGN KEY (room_id) REFERENCES public.rooms(id);
--
-- Name: messages messages_sender_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.messages
ADD CONSTRAINT messages_sender_id_fkey FOREIGN KEY (sender_id) REFERENCES public.users(id);
--
-- Name: notes notes_owner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.notes
ADD CONSTRAINT notes_owner_id_fkey FOREIGN KEY (owner_id) REFERENCES public.users(id);
--
-- Name: postcards postcards_recipient_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.postcards
ADD CONSTRAINT postcards_recipient_fkey FOREIGN KEY (recipient) REFERENCES public.users(id);
--
-- Name: postcards postcards_sender_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.postcards
ADD CONSTRAINT postcards_sender_fkey FOREIGN KEY (sender) REFERENCES public.users(id);
--
-- Name: questions questions_quiz_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.questions
ADD CONSTRAINT questions_quiz_id_fkey FOREIGN KEY (quiz_id) REFERENCES public.quizzes(id);
--
-- Name: responses responses_attempt_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.responses
ADD CONSTRAINT responses_attempt_id_fkey FOREIGN KEY (attempt_id) REFERENCES public.attempts(id);
--
-- Name: responses responses_question_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.responses
ADD CONSTRAINT responses_question_id_fkey FOREIGN KEY (question_id) REFERENCES public.questions(id);
--
-- Name: responses responses_quiz_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.responses
ADD CONSTRAINT responses_quiz_id_fkey FOREIGN KEY (quiz_id) REFERENCES public.quizzes(id);
--
-- Name: responses responses_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.responses
ADD CONSTRAINT responses_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: room_users room_users_room_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.room_users
ADD CONSTRAINT room_users_room_id_fkey FOREIGN KEY (room_id) REFERENCES public.rooms(id);
--
-- Name: room_users room_users_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.room_users
ADD CONSTRAINT room_users_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: sessions sessions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.sessions
ADD CONSTRAINT sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: threads threads_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.threads
ADD CONSTRAINT threads_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: users users_become_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: appuser
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_become_user_id_fkey FOREIGN KEY (become_user_id) REFERENCES public.users(id);
--
-- PostgreSQL database dump complete
--