This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
db_init.sql
460 lines (315 loc) · 9.56 KB
/
db_init.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
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.3
-- Dumped by pg_dump version 10.0
-- Started on 2018-03-16 15:34:29 CET
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- TOC entry 1 (class 3079 OID 12655)
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- TOC entry 2451 (class 0 OID 0)
-- Dependencies: 1
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 193 (class 1259 OID 24662)
-- Name: config; Type: TABLE; Schema: public; Owner: img
--
CREATE TABLE config (
key character varying(255) NOT NULL,
value json
);
ALTER TABLE config OWNER TO img;
--
-- TOC entry 188 (class 1259 OID 24600)
-- Name: images; Type: TABLE; Schema: public; Owner: img
--
CREATE TABLE images (
id integer NOT NULL,
filename character varying NOT NULL
);
ALTER TABLE images OWNER TO img;
--
-- TOC entry 187 (class 1259 OID 24598)
-- Name: image_id_seq; Type: SEQUENCE; Schema: public; Owner: img
--
CREATE SEQUENCE image_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE image_id_seq OWNER TO img;
--
-- TOC entry 2452 (class 0 OID 0)
-- Dependencies: 187
-- Name: image_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: img
--
ALTER SEQUENCE image_id_seq OWNED BY images.id;
--
-- TOC entry 186 (class 1259 OID 24587)
-- Name: labels; Type: TABLE; Schema: public; Owner: img
--
CREATE TABLE labels (
id smallint NOT NULL,
label character varying NOT NULL
);
ALTER TABLE labels OWNER TO img;
--
-- TOC entry 185 (class 1259 OID 24585)
-- Name: labels_id_seq; Type: SEQUENCE; Schema: public; Owner: img
--
CREATE SEQUENCE labels_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE labels_id_seq OWNER TO img;
--
-- TOC entry 2453 (class 0 OID 0)
-- Dependencies: 185
-- Name: labels_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: img
--
ALTER SEQUENCE labels_id_seq OWNED BY labels.id;
--
-- TOC entry 192 (class 1259 OID 24625)
-- Name: object_boxes; Type: TABLE; Schema: public; Owner: img
--
CREATE TABLE object_boxes (
id integer NOT NULL,
image_id integer NOT NULL,
label_id smallint NOT NULL,
x integer NOT NULL,
y integer NOT NULL,
w integer NOT NULL,
h integer NOT NULL
);
ALTER TABLE object_boxes OWNER TO img;
--
-- TOC entry 189 (class 1259 OID 24619)
-- Name: object_boxes_id_seq; Type: SEQUENCE; Schema: public; Owner: img
--
CREATE SEQUENCE object_boxes_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE object_boxes_id_seq OWNER TO img;
--
-- TOC entry 2454 (class 0 OID 0)
-- Dependencies: 189
-- Name: object_boxes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: img
--
ALTER SEQUENCE object_boxes_id_seq OWNED BY object_boxes.id;
--
-- TOC entry 190 (class 1259 OID 24621)
-- Name: object_boxes_image_id_seq; Type: SEQUENCE; Schema: public; Owner: img
--
CREATE SEQUENCE object_boxes_image_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE object_boxes_image_id_seq OWNER TO img;
--
-- TOC entry 2455 (class 0 OID 0)
-- Dependencies: 190
-- Name: object_boxes_image_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: img
--
ALTER SEQUENCE object_boxes_image_id_seq OWNED BY object_boxes.image_id;
--
-- TOC entry 191 (class 1259 OID 24623)
-- Name: object_boxes_label_seq; Type: SEQUENCE; Schema: public; Owner: img
--
CREATE SEQUENCE object_boxes_label_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE object_boxes_label_seq OWNER TO img;
--
-- TOC entry 2456 (class 0 OID 0)
-- Dependencies: 191
-- Name: object_boxes_label_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: img
--
ALTER SEQUENCE object_boxes_label_seq OWNED BY object_boxes.label_id;
--
-- TOC entry 194 (class 1259 OID 24670)
-- Name: session; Type: TABLE; Schema: public; Owner: img
--
CREATE TABLE session (
sid character varying NOT NULL,
sess json NOT NULL,
expire timestamp(6) without time zone NOT NULL
);
ALTER TABLE session OWNER TO img;
--
-- TOC entry 2296 (class 2604 OID 24603)
-- Name: images id; Type: DEFAULT; Schema: public; Owner: img
--
ALTER TABLE ONLY images ALTER COLUMN id SET DEFAULT nextval('image_id_seq'::regclass);
--
-- TOC entry 2295 (class 2604 OID 24590)
-- Name: labels id; Type: DEFAULT; Schema: public; Owner: img
--
ALTER TABLE ONLY labels ALTER COLUMN id SET DEFAULT nextval('labels_id_seq'::regclass);
--
-- TOC entry 2297 (class 2604 OID 24628)
-- Name: object_boxes id; Type: DEFAULT; Schema: public; Owner: img
--
ALTER TABLE ONLY object_boxes ALTER COLUMN id SET DEFAULT nextval('object_boxes_id_seq'::regclass);
--
-- TOC entry 2298 (class 2604 OID 24629)
-- Name: object_boxes image_id; Type: DEFAULT; Schema: public; Owner: img
--
ALTER TABLE ONLY object_boxes ALTER COLUMN image_id SET DEFAULT nextval('object_boxes_image_id_seq'::regclass);
--
-- TOC entry 2299 (class 2604 OID 24630)
-- Name: object_boxes label_id; Type: DEFAULT; Schema: public; Owner: img
--
ALTER TABLE ONLY object_boxes ALTER COLUMN label_id SET DEFAULT nextval('object_boxes_label_seq'::regclass);
--
-- TOC entry 2438 (class 0 OID 24600)
-- Dependencies: 188
-- Data for Name: images; Type: TABLE DATA; Schema: public; Owner: img
--
COPY images (id, filename) FROM stdin;
\.
--
-- TOC entry 2436 (class 0 OID 24587)
-- Dependencies: 186
-- Data for Name: labels; Type: TABLE DATA; Schema: public; Owner: img
--
COPY labels (id, label) FROM stdin;
\.
--
-- TOC entry 2442 (class 0 OID 24625)
-- Dependencies: 192
-- Data for Name: object_boxes; Type: TABLE DATA; Schema: public; Owner: img
--
COPY object_boxes (id, image_id, label_id, x, y, w, h) FROM stdin;
\.
--
-- TOC entry 2444 (class 0 OID 24670)
-- Dependencies: 194
-- Data for Name: session; Type: TABLE DATA; Schema: public; Owner: img
--
COPY session (sid, sess, expire) FROM stdin;
\.
--
-- TOC entry 2457 (class 0 OID 0)
-- Dependencies: 187
-- Name: image_id_seq; Type: SEQUENCE SET; Schema: public; Owner: img
--
SELECT pg_catalog.setval('image_id_seq', 1, true);
--
-- TOC entry 2458 (class 0 OID 0)
-- Dependencies: 185
-- Name: labels_id_seq; Type: SEQUENCE SET; Schema: public; Owner: img
--
SELECT pg_catalog.setval('labels_id_seq', 1, true);
--
-- TOC entry 2459 (class 0 OID 0)
-- Dependencies: 189
-- Name: object_boxes_id_seq; Type: SEQUENCE SET; Schema: public; Owner: img
--
SELECT pg_catalog.setval('object_boxes_id_seq', 1, true);
--
-- TOC entry 2460 (class 0 OID 0)
-- Dependencies: 190
-- Name: object_boxes_image_id_seq; Type: SEQUENCE SET; Schema: public; Owner: img
--
SELECT pg_catalog.setval('object_boxes_image_id_seq', 1, false);
--
-- TOC entry 2461 (class 0 OID 0)
-- Dependencies: 191
-- Name: object_boxes_label_seq; Type: SEQUENCE SET; Schema: public; Owner: img
--
SELECT pg_catalog.setval('object_boxes_label_seq', 1, false);
--
-- TOC entry 2313 (class 2606 OID 24669)
-- Name: config config_pkey; Type: CONSTRAINT; Schema: public; Owner: img
--
ALTER TABLE ONLY config
ADD CONSTRAINT config_pkey PRIMARY KEY (key);
--
-- TOC entry 2305 (class 2606 OID 24608)
-- Name: images image_pkey; Type: CONSTRAINT; Schema: public; Owner: img
--
ALTER TABLE ONLY images
ADD CONSTRAINT image_pkey PRIMARY KEY (id);
--
-- TOC entry 2301 (class 2606 OID 24595)
-- Name: labels labels_pkey; Type: CONSTRAINT; Schema: public; Owner: img
--
ALTER TABLE ONLY labels
ADD CONSTRAINT labels_pkey PRIMARY KEY (id);
--
-- TOC entry 2311 (class 2606 OID 24632)
-- Name: object_boxes object_boxes_pkey; Type: CONSTRAINT; Schema: public; Owner: img
--
ALTER TABLE ONLY object_boxes
ADD CONSTRAINT object_boxes_pkey PRIMARY KEY (id);
--
-- TOC entry 2315 (class 2606 OID 24677)
-- Name: session session_pkey; Type: CONSTRAINT; Schema: public; Owner: img
--
ALTER TABLE ONLY session
ADD CONSTRAINT session_pkey PRIMARY KEY (sid);
--
-- TOC entry 2307 (class 2606 OID 24679)
-- Name: images unique_file; Type: CONSTRAINT; Schema: public; Owner: img
--
ALTER TABLE ONLY images
ADD CONSTRAINT unique_file UNIQUE (filename);
--
-- TOC entry 2303 (class 2606 OID 24610)
-- Name: labels unique_label; Type: CONSTRAINT; Schema: public; Owner: img
--
ALTER TABLE ONLY labels
ADD CONSTRAINT unique_label UNIQUE (label);
--
-- TOC entry 2308 (class 1259 OID 24644)
-- Name: fki_label_id; Type: INDEX; Schema: public; Owner: img
--
CREATE INDEX fki_label_id ON object_boxes USING btree (label_id);
--
-- TOC entry 2309 (class 1259 OID 24633)
-- Name: image_id; Type: INDEX; Schema: public; Owner: img
--
CREATE INDEX image_id ON object_boxes USING btree (image_id);
--
-- TOC entry 2316 (class 2606 OID 24645)
-- Name: object_boxes image_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: img
--
ALTER TABLE ONLY object_boxes
ADD CONSTRAINT image_id_fkey FOREIGN KEY (image_id) REFERENCES images(id);
--
-- TOC entry 2317 (class 2606 OID 24639)
-- Name: object_boxes label_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: img
--
ALTER TABLE ONLY object_boxes
ADD CONSTRAINT label_id_fkey FOREIGN KEY (label_id) REFERENCES labels(id);
-- Completed on 2018-03-16 15:34:29 CET
--
-- PostgreSQL database dump complete
--