This repository has been archived by the owner on Apr 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
xpub-schema.sql
437 lines (318 loc) · 9.55 KB
/
xpub-schema.sql
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
--
-- PostgreSQL database dump
--
-- Dumped from database version 10.6
-- Dumped by pg_dump version 10.10 (Ubuntu 10.10-0ubuntu0.18.04.1)
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: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public;
--
-- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions';
--
-- Name: auditaction; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.auditaction AS ENUM (
'CREATED',
'UPDATED',
'DELETED',
'MECA_RESULT',
'LOGGED_IN'
);
--
-- Name: filestatus; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.filestatus AS ENUM (
'CREATED',
'UPLOADED',
'STORED',
'CANCELLED',
'DELETED'
);
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: audit_log; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.audit_log (
id uuid NOT NULL,
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
user_id text,
object_id uuid,
object_type text,
updated timestamp with time zone,
value text,
action public.auditaction
);
--
-- Name: ejp_name; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.ejp_name (
id integer NOT NULL,
first text,
last text
);
--
-- Name: entities; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.entities (
id uuid NOT NULL,
data jsonb
);
--
-- Name: file; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.file (
id uuid NOT NULL,
manuscript_id uuid NOT NULL,
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated timestamp with time zone,
type text,
label text,
filename text NOT NULL,
url text NOT NULL,
mime_type text,
size integer,
status public.filestatus DEFAULT 'CREATED'::public.filestatus
);
--
-- Name: identity; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.identity (
id uuid NOT NULL,
user_id uuid NOT NULL,
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated timestamp with time zone,
type text NOT NULL,
identifier text,
display_name text,
email text,
meta jsonb
);
--
-- Name: journal; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.journal (
id uuid NOT NULL,
organization_id uuid NOT NULL,
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated timestamp with time zone,
journal_title text NOT NULL,
"meta,publisher_name" text
);
--
-- Name: manuscript; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.manuscript (
id uuid NOT NULL,
journal_id uuid,
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated timestamp with time zone,
created_by text NOT NULL,
previous_version uuid,
status text NOT NULL,
last_step_visited text,
decision text,
cover_letter text,
previously_discussed text,
previously_submitted text[],
cosubmission text[],
opposed_senior_editors_reason text,
opposed_reviewing_editors_reason text,
related_manuscripts jsonb[],
submitter_signature text,
disclosure_consent boolean,
qc_issues jsonb[],
opposed_reviewers_reason text,
meta jsonb
);
--
-- Name: migrations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.migrations (
id text NOT NULL,
run_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);
--
-- Name: organization; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.organization (
id uuid NOT NULL,
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated timestamp with time zone,
name text NOT NULL
);
--
-- Name: review; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.review (
id uuid NOT NULL,
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated timestamp with time zone,
comments jsonb[],
recommendation text,
open boolean,
user_id uuid NOT NULL
);
--
-- Name: semantic_extraction; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.semantic_extraction (
id uuid NOT NULL,
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated timestamp with time zone,
manuscript_id uuid NOT NULL,
field_name text NOT NULL,
value text
);
--
-- Name: survey_response; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.survey_response (
id uuid NOT NULL,
survey_id character varying(255) NOT NULL,
manuscript_id uuid NOT NULL,
response jsonb NOT NULL,
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated timestamp with time zone
);
--
-- Name: team; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.team (
id uuid NOT NULL,
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated timestamp with time zone,
team_members jsonb[] NOT NULL,
role text NOT NULL,
object_id uuid NOT NULL,
object_type text NOT NULL
);
--
-- Name: user; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."user" (
id uuid NOT NULL,
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated timestamp with time zone,
default_identity text
);
--
-- Name: audit_log audit_log_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.audit_log
ADD CONSTRAINT audit_log_pkey PRIMARY KEY (id);
--
-- Name: ejp_name ejp_name_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.ejp_name
ADD CONSTRAINT ejp_name_pkey PRIMARY KEY (id);
--
-- Name: entities entities_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.entities
ADD CONSTRAINT entities_pkey PRIMARY KEY (id);
--
-- Name: file file_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.file
ADD CONSTRAINT file_pkey PRIMARY KEY (id);
--
-- Name: identity identity_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.identity
ADD CONSTRAINT identity_pkey PRIMARY KEY (id);
--
-- Name: journal journal_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.journal
ADD CONSTRAINT journal_pkey PRIMARY KEY (id);
--
-- Name: manuscript manuscript_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.manuscript
ADD CONSTRAINT manuscript_pkey PRIMARY KEY (id);
--
-- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.migrations
ADD CONSTRAINT migrations_pkey PRIMARY KEY (id);
--
-- Name: organization organization_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.organization
ADD CONSTRAINT organization_pkey PRIMARY KEY (id);
--
-- Name: review review_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.review
ADD CONSTRAINT review_pkey PRIMARY KEY (id);
--
-- Name: semantic_extraction semantic_extraction_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.semantic_extraction
ADD CONSTRAINT semantic_extraction_pkey PRIMARY KEY (id);
--
-- Name: survey_response survey_response_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.survey_response
ADD CONSTRAINT survey_response_pkey PRIMARY KEY (id);
--
-- Name: team team_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.team
ADD CONSTRAINT team_pkey PRIMARY KEY (id);
--
-- Name: user user_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."user"
ADD CONSTRAINT user_pkey PRIMARY KEY (id);
--
-- Name: ejp_name_concat; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX ejp_name_concat ON public.ejp_name USING btree (lower(((first || ' '::text) || last)));
--
-- Name: identity identity_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.identity
ADD CONSTRAINT identity_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id);
--
-- Name: journal journal_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.journal
ADD CONSTRAINT journal_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES public.organization(id);
--
-- Name: manuscript manuscript_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.manuscript
ADD CONSTRAINT manuscript_journal_id_fkey FOREIGN KEY (journal_id) REFERENCES public.journal(id);
--
-- Name: manuscript manuscript_previous_version_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.manuscript
ADD CONSTRAINT manuscript_previous_version_fkey FOREIGN KEY (previous_version) REFERENCES public.manuscript(id);
--
-- Name: review review_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.review
ADD CONSTRAINT review_user_id_fkey FOREIGN KEY (user_id) REFERENCES public."user"(id);