-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunindexed.sql
More file actions
640 lines (432 loc) · 19.9 KB
/
unindexed.sql
File metadata and controls
640 lines (432 loc) · 19.9 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
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.12 (Debian 14.12-1.pgdg120+1)
-- Dumped by pg_dump version 16.3
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;
--
-- Name: unindexed; Type: SCHEMA; Schema: -; Owner: testUser
--
CREATE SCHEMA unindexed;
ALTER SCHEMA unindexed OWNER TO "testUser";
--
-- Name: SCHEMA unindexed; Type: COMMENT; Schema: -; Owner: testUser
--
COMMENT ON SCHEMA unindexed IS 'standard unindexed schema';
--
-- Name: log_severity_enum; Type: TYPE; Schema: unindexed; Owner: testUser
--
CREATE TYPE unindexed.log_severity_enum AS ENUM (
'INFO',
'DEBUG',
'VERBOSE',
'WARNING',
'ERROR',
'CRITICAL'
);
ALTER TYPE unindexed.log_severity_enum OWNER TO "testUser";
--
-- Name: message_author_enum; Type: TYPE; Schema: unindexed; Owner: testUser
--
CREATE TYPE unindexed.message_author_enum AS ENUM (
'user',
'system',
'bot'
);
ALTER TYPE unindexed.message_author_enum OWNER TO "testUser";
--
-- Name: task_editor_role_enum; Type: TYPE; Schema: unindexed; Owner: testUser
--
CREATE TYPE unindexed.task_editor_role_enum AS ENUM (
'none',
'editor',
'owner'
);
ALTER TYPE unindexed.task_editor_role_enum OWNER TO "testUser";
--
-- Name: task_visibility_enum; Type: TYPE; Schema: unindexed; Owner: testUser
--
CREATE TYPE unindexed.task_visibility_enum AS ENUM (
'unlisted',
'editors_patient_only',
'unindexed'
);
ALTER TYPE unindexed.task_visibility_enum OWNER TO "testUser";
--
-- Name: word_retrieval_hint_type_enum; Type: TYPE; Schema: unindexed; Owner: testUser
--
CREATE TYPE unindexed.word_retrieval_hint_type_enum AS ENUM (
'message',
'option_select'
);
ALTER TYPE unindexed.word_retrieval_hint_type_enum OWNER TO "testUser";
--
-- Name: word_retrieval_input_restriction; Type: TYPE; Schema: unindexed; Owner: testUser
--
CREATE TYPE unindexed.word_retrieval_input_restriction AS ENUM (
'NONE',
'TEXT_ONLY',
'VOICE_ONLY'
);
ALTER TYPE unindexed.word_retrieval_input_restriction OWNER TO "testUser";
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: admin; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.admin (
id uuid DEFAULT gen_random_uuid() NOT NULL,
username text NOT NULL,
hashed_password text NOT NULL
);
ALTER TABLE unindexed.admin OWNER TO "testUser";
--
-- Name: admin_session_token; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.admin_session_token (
token character varying(256) NOT NULL,
admin_id uuid NOT NULL,
encrypted_client_info text NOT NULL,
last_used timestamp(0) without time zone DEFAULT now() NOT NULL,
created_at timestamp(0) without time zone DEFAULT now() NOT NULL,
expiry_date timestamp(0) without time zone
);
ALTER TABLE unindexed.admin_session_token OWNER TO "testUser";
--
-- Name: enrollment_code; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.enrollment_code (
code character varying(256) NOT NULL,
staff_id uuid NOT NULL,
patient_username text NOT NULL,
created_at date DEFAULT now() NOT NULL
);
ALTER TABLE unindexed.enrollment_code OWNER TO "testUser";
--
-- Name: log; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.log (
id integer NOT NULL,
message text NOT NULL,
severity unindexed.log_severity_enum DEFAULT 'INFO'::unindexed.log_severity_enum NOT NULL,
at timestamp(0) without time zone DEFAULT now() NOT NULL
);
ALTER TABLE unindexed.log OWNER TO "testUser";
--
-- Name: log_id_seq; Type: SEQUENCE; Schema: unindexed; Owner: testUser
--
CREATE SEQUENCE unindexed.log_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE unindexed.log_id_seq OWNER TO "testUser";
--
-- Name: log_id_seq; Type: SEQUENCE OWNED BY; Schema: unindexed; Owner: testUser
--
ALTER SEQUENCE unindexed.log_id_seq OWNED BY unindexed.log.id;
--
-- Name: patient; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.patient (
id uuid DEFAULT gen_random_uuid() NOT NULL,
username text NOT NULL,
hashed_password text NOT NULL,
enrolled_at timestamp(0) without time zone DEFAULT now() NOT NULL
);
ALTER TABLE unindexed.patient OWNER TO "testUser";
--
-- Name: patient_session_token; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.patient_session_token (
token character varying(256) NOT NULL,
patient_id uuid NOT NULL,
encrypted_client_info text NOT NULL,
last_used timestamp(0) without time zone DEFAULT now() NOT NULL,
created_at timestamp(0) without time zone DEFAULT now() NOT NULL,
expiry_date timestamp(0) without time zone
);
ALTER TABLE unindexed.patient_session_token OWNER TO "testUser";
--
-- Name: patient_staff; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.patient_staff (
patient_id uuid NOT NULL,
staff_id uuid NOT NULL,
assigned_at timestamp(0) without time zone DEFAULT now() NOT NULL
);
ALTER TABLE unindexed.patient_staff OWNER TO "testUser";
--
-- Name: staff; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.staff (
id uuid DEFAULT gen_random_uuid() NOT NULL,
username text NOT NULL,
hashed_password text NOT NULL
);
ALTER TABLE unindexed.staff OWNER TO "testUser";
--
-- Name: staff_session_token; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.staff_session_token (
token character varying(256) NOT NULL,
staff_id uuid NOT NULL,
encrypted_client_info text NOT NULL,
last_used timestamp(0) without time zone DEFAULT now() NOT NULL,
created_at timestamp(0) without time zone DEFAULT now() NOT NULL,
expiry_date timestamp(0) without time zone
);
ALTER TABLE unindexed.staff_session_token OWNER TO "testUser";
--
-- Name: task; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.task (
id uuid DEFAULT gen_random_uuid() NOT NULL,
name text NOT NULL,
description text,
task_visibility unindexed.task_visibility_enum DEFAULT 'unlisted'::unindexed.task_visibility_enum NOT NULL,
created_at timestamp(0) without time zone DEFAULT now() NOT NULL
);
ALTER TABLE unindexed.task OWNER TO "testUser";
--
-- Name: task_editor; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.task_editor (
task_id uuid NOT NULL,
staff_id uuid NOT NULL,
role unindexed.task_editor_role_enum DEFAULT 'owner'::unindexed.task_editor_role_enum NOT NULL
);
ALTER TABLE unindexed.task_editor OWNER TO "testUser";
--
-- Name: word_retrieval_session; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.word_retrieval_session (
id uuid DEFAULT gen_random_uuid() NOT NULL,
patient_id uuid NOT NULL,
task_id uuid NOT NULL,
hints_used_count smallint DEFAULT 0 NOT NULL,
started_at timestamp(0) without time zone DEFAULT now() NOT NULL,
completed_at timestamp(0) without time zone,
is_successful boolean
);
ALTER TABLE unindexed.word_retrieval_session OWNER TO "testUser";
--
-- Name: word_retrieval_session_message; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.word_retrieval_session_message (
id uuid DEFAULT gen_random_uuid() NOT NULL,
session_id uuid NOT NULL,
author unindexed.message_author_enum NOT NULL,
content text NOT NULL,
sent_at timestamp(0) without time zone DEFAULT now() NOT NULL
);
ALTER TABLE unindexed.word_retrieval_session_message OWNER TO "testUser";
--
-- Name: word_retrieval_task; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.word_retrieval_task (
task_id uuid NOT NULL,
image_path text NOT NULL,
answer text NOT NULL,
input_restriction unindexed.word_retrieval_input_restriction DEFAULT 'NONE'::unindexed.word_retrieval_input_restriction NOT NULL
);
ALTER TABLE unindexed.word_retrieval_task OWNER TO "testUser";
--
-- Name: word_retrieval_task_hint; Type: TABLE; Schema: unindexed; Owner: testUser
--
CREATE TABLE unindexed.word_retrieval_task_hint (
hint_number smallint NOT NULL,
task_id uuid NOT NULL,
content text NOT NULL,
type unindexed.word_retrieval_hint_type_enum NOT NULL,
hierarchy_num integer NOT NULL
);
ALTER TABLE unindexed.word_retrieval_task_hint OWNER TO "testUser";
--
-- Name: log id; Type: DEFAULT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.log ALTER COLUMN id SET DEFAULT nextval('unindexed.log_id_seq'::regclass);
--
-- Name: admin admin_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.admin
ADD CONSTRAINT admin_pkey PRIMARY KEY (id);
--
-- Name: admin_session_token admin_session_token_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.admin_session_token
ADD CONSTRAINT admin_session_token_pkey PRIMARY KEY (token);
--
-- Name: admin admin_username_unique; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.admin
ADD CONSTRAINT admin_username_unique UNIQUE (username);
--
-- Name: enrollment_code enrollment_code_patient_username_unique; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.enrollment_code
ADD CONSTRAINT enrollment_code_patient_username_unique UNIQUE (patient_username);
--
-- Name: enrollment_code enrollment_code_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.enrollment_code
ADD CONSTRAINT enrollment_code_pkey PRIMARY KEY (code);
--
-- Name: log log_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.log
ADD CONSTRAINT log_pkey PRIMARY KEY (id);
--
-- Name: patient patient_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.patient
ADD CONSTRAINT patient_pkey PRIMARY KEY (id);
--
-- Name: patient_session_token patient_session_token_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.patient_session_token
ADD CONSTRAINT patient_session_token_pkey PRIMARY KEY (token);
--
-- Name: patient_staff patient_staff_patient_id_staff_id_pk; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.patient_staff
ADD CONSTRAINT patient_staff_patient_id_staff_id_pk PRIMARY KEY (patient_id, staff_id);
--
-- Name: patient patient_username_unique; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.patient
ADD CONSTRAINT patient_username_unique UNIQUE (username);
--
-- Name: staff staff_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.staff
ADD CONSTRAINT staff_pkey PRIMARY KEY (id);
--
-- Name: staff_session_token staff_session_token_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.staff_session_token
ADD CONSTRAINT staff_session_token_pkey PRIMARY KEY (token);
--
-- Name: staff staff_username_unique; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.staff
ADD CONSTRAINT staff_username_unique UNIQUE (username);
--
-- Name: task_editor task_editor_task_id_staff_id_pk; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.task_editor
ADD CONSTRAINT task_editor_task_id_staff_id_pk PRIMARY KEY (task_id, staff_id);
--
-- Name: task task_name_unique; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.task
ADD CONSTRAINT task_name_unique UNIQUE (name);
--
-- Name: task task_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.task
ADD CONSTRAINT task_pkey PRIMARY KEY (id);
--
-- Name: word_retrieval_session_message word_retrieval_session_message_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.word_retrieval_session_message
ADD CONSTRAINT word_retrieval_session_message_pkey PRIMARY KEY (id);
--
-- Name: word_retrieval_session word_retrieval_session_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.word_retrieval_session
ADD CONSTRAINT word_retrieval_session_pkey PRIMARY KEY (id);
--
-- Name: word_retrieval_task_hint word_retrieval_task_hint_hint_number_task_id_pk; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.word_retrieval_task_hint
ADD CONSTRAINT word_retrieval_task_hint_hint_number_task_id_pk PRIMARY KEY (hint_number, task_id);
--
-- Name: word_retrieval_task word_retrieval_task_pkey; Type: CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.word_retrieval_task
ADD CONSTRAINT word_retrieval_task_pkey PRIMARY KEY (task_id);
--
-- Name: admin_session_token admin_session_token_admin_id_admin_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.admin_session_token
ADD CONSTRAINT admin_session_token_admin_id_admin_id_fk FOREIGN KEY (admin_id) REFERENCES unindexed.admin(id) ON DELETE CASCADE;
--
-- Name: enrollment_code enrollment_code_staff_id_staff_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.enrollment_code
ADD CONSTRAINT enrollment_code_staff_id_staff_id_fk FOREIGN KEY (staff_id) REFERENCES unindexed.staff(id) ON DELETE CASCADE;
--
-- Name: patient_session_token patient_session_token_patient_id_patient_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.patient_session_token
ADD CONSTRAINT patient_session_token_patient_id_patient_id_fk FOREIGN KEY (patient_id) REFERENCES unindexed.patient(id) ON DELETE CASCADE;
--
-- Name: patient_staff patient_staff_patient_id_patient_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.patient_staff
ADD CONSTRAINT patient_staff_patient_id_patient_id_fk FOREIGN KEY (patient_id) REFERENCES unindexed.patient(id) ON DELETE CASCADE;
--
-- Name: patient_staff patient_staff_staff_id_staff_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.patient_staff
ADD CONSTRAINT patient_staff_staff_id_staff_id_fk FOREIGN KEY (staff_id) REFERENCES unindexed.staff(id) ON DELETE CASCADE;
--
-- Name: staff_session_token staff_session_token_staff_id_staff_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.staff_session_token
ADD CONSTRAINT staff_session_token_staff_id_staff_id_fk FOREIGN KEY (staff_id) REFERENCES unindexed.staff(id) ON DELETE CASCADE;
--
-- Name: task_editor task_editor_staff_id_staff_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.task_editor
ADD CONSTRAINT task_editor_staff_id_staff_id_fk FOREIGN KEY (staff_id) REFERENCES unindexed.staff(id) ON DELETE CASCADE;
--
-- Name: task_editor task_editor_task_id_task_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.task_editor
ADD CONSTRAINT task_editor_task_id_task_id_fk FOREIGN KEY (task_id) REFERENCES unindexed.task(id) ON DELETE CASCADE;
--
-- Name: word_retrieval_session_message word_retrieval_session_message_session_id_word_retrieval_sessio; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.word_retrieval_session_message
ADD CONSTRAINT word_retrieval_session_message_session_id_word_retrieval_sessio FOREIGN KEY (session_id) REFERENCES unindexed.word_retrieval_session(id) ON DELETE CASCADE;
--
-- Name: word_retrieval_session word_retrieval_session_patient_id_patient_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.word_retrieval_session
ADD CONSTRAINT word_retrieval_session_patient_id_patient_id_fk FOREIGN KEY (patient_id) REFERENCES unindexed.patient(id) ON DELETE CASCADE;
--
-- Name: word_retrieval_session word_retrieval_session_task_id_word_retrieval_task_task_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.word_retrieval_session
ADD CONSTRAINT word_retrieval_session_task_id_word_retrieval_task_task_id_fk FOREIGN KEY (task_id) REFERENCES unindexed.word_retrieval_task(task_id) ON DELETE CASCADE;
--
-- Name: word_retrieval_task_hint word_retrieval_task_hint_task_id_task_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.word_retrieval_task_hint
ADD CONSTRAINT word_retrieval_task_hint_task_id_task_id_fk FOREIGN KEY (task_id) REFERENCES unindexed.task(id) ON DELETE CASCADE;
--
-- Name: word_retrieval_task word_retrieval_task_task_id_task_id_fk; Type: FK CONSTRAINT; Schema: unindexed; Owner: testUser
--
ALTER TABLE ONLY unindexed.word_retrieval_task
ADD CONSTRAINT word_retrieval_task_task_id_task_id_fk FOREIGN KEY (task_id) REFERENCES unindexed.task(id) ON DELETE CASCADE;
--
-- Name: SCHEMA unindexed; Type: ACL; Schema: -; Owner: testUser
--
REVOKE USAGE ON SCHEMA unindexed FROM public;
GRANT ALL ON SCHEMA unindexed TO public;
--
-- PostgreSQL database dump complete
--