-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdb_schema.sql
409 lines (291 loc) · 9.97 KB
/
db_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
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.1
-- Dumped by pg_dump version 14.1
-- Started on 2022-06-02 18:38:13
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;
DROP DATABASE projecthree;
--
-- TOC entry 3350 (class 1262 OID 16394)
-- Name: projecthree; Type: DATABASE; Schema: -; Owner: postgres
--
CREATE DATABASE projecthree WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE = 'English_United States.1252';
ALTER DATABASE projecthree OWNER TO postgres;
\connect projecthree
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;
--
-- TOC entry 3351 (class 0 OID 0)
-- Dependencies: 3350
-- Name: DATABASE projecthree; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON DATABASE projecthree IS 'A school project management system.';
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- TOC entry 216 (class 1259 OID 24629)
-- Name: collaborators; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.collaborators (
id integer NOT NULL,
user_id integer NOT NULL,
project_id integer NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);
ALTER TABLE public.collaborators OWNER TO postgres;
--
-- TOC entry 215 (class 1259 OID 24628)
-- Name: collaborators_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.collaborators_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.collaborators_id_seq OWNER TO postgres;
--
-- TOC entry 3352 (class 0 OID 0)
-- Dependencies: 215
-- Name: collaborators_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.collaborators_id_seq OWNED BY public.collaborators.id;
--
-- TOC entry 212 (class 1259 OID 24594)
-- Name: departments; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.departments (
id integer NOT NULL,
name text NOT NULL,
acronym text NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);
ALTER TABLE public.departments OWNER TO postgres;
--
-- TOC entry 211 (class 1259 OID 24593)
-- Name: departments_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.departments_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.departments_id_seq OWNER TO postgres;
--
-- TOC entry 3353 (class 0 OID 0)
-- Dependencies: 211
-- Name: departments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.departments_id_seq OWNED BY public.departments.id;
--
-- TOC entry 214 (class 1259 OID 24614)
-- Name: projects; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.projects (
id integer NOT NULL,
department_id integer NOT NULL,
topic text NOT NULL,
description text NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);
ALTER TABLE public.projects OWNER TO postgres;
--
-- TOC entry 213 (class 1259 OID 24613)
-- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.projects_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.projects_id_seq OWNER TO postgres;
--
-- TOC entry 3354 (class 0 OID 0)
-- Dependencies: 213
-- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.projects_id_seq OWNED BY public.projects.id;
--
-- TOC entry 210 (class 1259 OID 16399)
-- Name: users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.users (
id integer NOT NULL,
first_name text NOT NULL,
last_name text NOT NULL,
email text NOT NULL,
password text NOT NULL,
created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);
ALTER TABLE public.users OWNER TO postgres;
--
-- TOC entry 209 (class 1259 OID 16398)
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.users_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.users_id_seq OWNER TO postgres;
--
-- TOC entry 3355 (class 0 OID 0)
-- Dependencies: 209
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
--
-- TOC entry 3185 (class 2604 OID 24632)
-- Name: collaborators id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.collaborators ALTER COLUMN id SET DEFAULT nextval('public.collaborators_id_seq'::regclass);
--
-- TOC entry 3181 (class 2604 OID 24597)
-- Name: departments id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.departments ALTER COLUMN id SET DEFAULT nextval('public.departments_id_seq'::regclass);
--
-- TOC entry 3183 (class 2604 OID 24617)
-- Name: projects id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.projects ALTER COLUMN id SET DEFAULT nextval('public.projects_id_seq'::regclass);
--
-- TOC entry 3179 (class 2604 OID 16402)
-- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
--
-- TOC entry 3344 (class 0 OID 24629)
-- Dependencies: 216
-- Data for Name: collaborators; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.collaborators (id, user_id, project_id, created_at) FROM stdin;
2 7 5 2022-06-01 22:49:10
4 7 7 2022-06-02 13:45:27
5 8 7 2022-06-02 15:40:18
\.
--
-- TOC entry 3340 (class 0 OID 24594)
-- Dependencies: 212
-- Data for Name: departments; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.departments (id, name, acronym, created_at) FROM stdin;
2 Informantion Technology IFT 2022-06-01 11:28:42
3 Computer Science CSC 2022-06-01 11:30:47
4 Cyber Security CYB 2022-06-01 12:36:24
\.
--
-- TOC entry 3342 (class 0 OID 24614)
-- Dependencies: 214
-- Data for Name: projects; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.projects (id, department_id, topic, description, created_at) FROM stdin;
5 2 Food mix in technology Technology has helped food very well. 2022-06-01 22:49:10
7 3 Benefits of corn computer Corn mixed with computer is great 2022-06-02 13:45:27
\.
--
-- TOC entry 3338 (class 0 OID 16399)
-- Dependencies: 210
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.users (id, first_name, last_name, email, password, created_at) FROM stdin;
8 Chike Paul [email protected] 111111 2022-05-27 11:28:17
10 Beans Rice [email protected] 111111 2022-05-27 13:05:21
11 Ben Author [email protected] 111111 2022-05-27 17:26:37
7 Jasper Anelechukwu [email protected] 222222 2022-05-27 11:25:02
\.
--
-- TOC entry 3356 (class 0 OID 0)
-- Dependencies: 215
-- Name: collaborators_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.collaborators_id_seq', 5, true);
--
-- TOC entry 3357 (class 0 OID 0)
-- Dependencies: 211
-- Name: departments_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.departments_id_seq', 6, true);
--
-- TOC entry 3358 (class 0 OID 0)
-- Dependencies: 213
-- Name: projects_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.projects_id_seq', 7, true);
--
-- TOC entry 3359 (class 0 OID 0)
-- Dependencies: 209
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.users_id_seq', 11, true);
--
-- TOC entry 3194 (class 2606 OID 24635)
-- Name: collaborators collaborators_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.collaborators
ADD CONSTRAINT collaborators_pkey PRIMARY KEY (id);
--
-- TOC entry 3190 (class 2606 OID 24601)
-- Name: departments departments_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.departments
ADD CONSTRAINT departments_pkey PRIMARY KEY (id);
--
-- TOC entry 3192 (class 2606 OID 24622)
-- Name: projects projects_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.projects
ADD CONSTRAINT projects_pkey PRIMARY KEY (id);
--
-- TOC entry 3188 (class 2606 OID 16407)
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- TOC entry 3197 (class 2606 OID 24641)
-- Name: collaborators collaborators_project_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.collaborators
ADD CONSTRAINT collaborators_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.projects(id);
--
-- TOC entry 3196 (class 2606 OID 24636)
-- Name: collaborators collaborators_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.collaborators
ADD CONSTRAINT collaborators_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- TOC entry 3195 (class 2606 OID 24623)
-- Name: projects projects_department_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.projects
ADD CONSTRAINT projects_department_id_fkey FOREIGN KEY (department_id) REFERENCES public.departments(id);
-- Completed on 2022-06-02 18:38:14
--
-- PostgreSQL database dump complete
--