-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathumbra-postgresql.sql
More file actions
623 lines (414 loc) · 13.1 KB
/
umbra-postgresql.sql
File metadata and controls
623 lines (414 loc) · 13.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
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
--
-- Name: umbra; Type: DATABASE; Schema: -; Owner: umbra
--
CREATE DATABASE umbra WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'pl_PL.UTF-8' LC_CTYPE = 'pl_PL.UTF-8';
ALTER DATABASE umbra OWNER TO umbra;
\connect umbra
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: entry; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE entry (
id bigint NOT NULL,
version bigint NOT NULL,
content character varying(5000),
date_created timestamp without time zone NOT NULL,
last_updated timestamp without time zone NOT NULL,
permalink character varying(1500) NOT NULL,
publish_date timestamp without time zone NOT NULL,
title character varying(400) NOT NULL
);
ALTER TABLE public.entry OWNER TO umbra;
--
-- Name: entry_id_seq; Type: SEQUENCE; Schema: public; Owner: umbra
--
CREATE SEQUENCE entry_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.entry_id_seq OWNER TO umbra;
--
-- Name: entry_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: umbra
--
ALTER SEQUENCE entry_id_seq OWNED BY entry.id;
--
-- Name: entry_picture; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE entry_picture (
entry_pictures_id bigint,
picture_id bigint,
pictures_idx integer
);
ALTER TABLE public.entry_picture OWNER TO umbra;
--
-- Name: entry_tag; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE entry_tag (
entry_tags_id bigint,
tag_id bigint
);
ALTER TABLE public.entry_tag OWNER TO umbra;
--
-- Name: format; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE format (
id bigint NOT NULL,
version bigint NOT NULL,
date_created timestamp without time zone NOT NULL,
file_size bigint NOT NULL,
height integer NOT NULL,
path character varying(255) NOT NULL,
picture_id bigint NOT NULL,
type character varying(255) NOT NULL,
width integer NOT NULL
);
ALTER TABLE public.format OWNER TO umbra;
--
-- Name: format_id_seq; Type: SEQUENCE; Schema: public; Owner: umbra
--
CREATE SEQUENCE format_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.format_id_seq OWNER TO umbra;
--
-- Name: format_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: umbra
--
ALTER SEQUENCE format_id_seq OWNED BY format.id;
--
-- Name: person; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE person (
id bigint NOT NULL,
version bigint NOT NULL,
display_order integer,
full_name character varying(120) NOT NULL,
short_name character varying(20) NOT NULL
);
ALTER TABLE public.person OWNER TO umbra;
--
-- Name: person_id_seq; Type: SEQUENCE; Schema: public; Owner: umbra
--
CREATE SEQUENCE person_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.person_id_seq OWNER TO umbra;
--
-- Name: person_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: umbra
--
ALTER SEQUENCE person_id_seq OWNED BY person.id;
--
-- Name: picture; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE picture (
id bigint NOT NULL,
version bigint NOT NULL,
camera character varying(255),
date_created timestamp without time zone NOT NULL,
date_taken timestamp without time zone NOT NULL,
last_updated timestamp without time zone NOT NULL,
location_altitude character varying(64),
location_latitude character varying(32),
location_longitude character varying(32),
original_filename character varying(400) NOT NULL,
title character varying(400)
);
ALTER TABLE public.picture OWNER TO umbra;
--
-- Name: picture_id_seq; Type: SEQUENCE; Schema: public; Owner: umbra
--
CREATE SEQUENCE picture_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.picture_id_seq OWNER TO umbra;
--
-- Name: picture_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: umbra
--
ALTER SEQUENCE picture_id_seq OWNED BY picture.id;
--
-- Name: picture_person; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE picture_person (
picture_people_id bigint,
person_id bigint
);
ALTER TABLE public.picture_person OWNER TO umbra;
--
-- Name: tag; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE tag (
id bigint NOT NULL,
version bigint NOT NULL,
name character varying(80) NOT NULL
);
ALTER TABLE public.tag OWNER TO umbra;
--
-- Name: tag_id_seq; Type: SEQUENCE; Schema: public; Owner: umbra
--
CREATE SEQUENCE tag_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.tag_id_seq OWNER TO umbra;
--
-- Name: tag_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: umbra
--
ALTER SEQUENCE tag_id_seq OWNED BY tag.id;
--
-- Name: umbra_role; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE umbra_role (
id bigint NOT NULL,
version bigint NOT NULL,
name character varying(255) NOT NULL
);
ALTER TABLE public.umbra_role OWNER TO umbra;
--
-- Name: umbra_role_id_seq; Type: SEQUENCE; Schema: public; Owner: umbra
--
CREATE SEQUENCE umbra_role_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.umbra_role_id_seq OWNER TO umbra;
--
-- Name: umbra_role_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: umbra
--
ALTER SEQUENCE umbra_role_id_seq OWNED BY umbra_role.id;
--
-- Name: umbra_role_permissions; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE umbra_role_permissions (
role_id bigint,
permissions_string character varying(255)
);
ALTER TABLE public.umbra_role_permissions OWNER TO umbra;
--
-- Name: umbra_user; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE umbra_user (
id bigint NOT NULL,
version bigint NOT NULL,
password_hash character varying(255) NOT NULL,
username character varying(40) NOT NULL
);
ALTER TABLE public.umbra_user OWNER TO umbra;
--
-- Name: umbra_user_id_seq; Type: SEQUENCE; Schema: public; Owner: umbra
--
CREATE SEQUENCE umbra_user_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.umbra_user_id_seq OWNER TO umbra;
--
-- Name: umbra_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: umbra
--
ALTER SEQUENCE umbra_user_id_seq OWNED BY umbra_user.id;
--
-- Name: umbra_user_permissions; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE umbra_user_permissions (
user_id bigint,
permissions_string character varying(255)
);
ALTER TABLE public.umbra_user_permissions OWNER TO umbra;
--
-- Name: umbra_user_roles; Type: TABLE; Schema: public; Owner: umbra; Tablespace:
--
CREATE TABLE umbra_user_roles (
user_id bigint NOT NULL,
role_id bigint NOT NULL
);
ALTER TABLE public.umbra_user_roles OWNER TO umbra;
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: umbra
--
ALTER TABLE entry ALTER COLUMN id SET DEFAULT nextval('entry_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: umbra
--
ALTER TABLE format ALTER COLUMN id SET DEFAULT nextval('format_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: umbra
--
ALTER TABLE person ALTER COLUMN id SET DEFAULT nextval('person_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: umbra
--
ALTER TABLE picture ALTER COLUMN id SET DEFAULT nextval('picture_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: umbra
--
ALTER TABLE tag ALTER COLUMN id SET DEFAULT nextval('tag_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: umbra
--
ALTER TABLE umbra_role ALTER COLUMN id SET DEFAULT nextval('umbra_role_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: umbra
--
ALTER TABLE umbra_user ALTER COLUMN id SET DEFAULT nextval('umbra_user_id_seq'::regclass);
--
-- Name: entry_permalink_key; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY entry
ADD CONSTRAINT entry_permalink_key UNIQUE (permalink);
--
-- Name: entry_pkey; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY entry
ADD CONSTRAINT entry_pkey PRIMARY KEY (id);
--
-- Name: format_path_key; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY format
ADD CONSTRAINT format_path_key UNIQUE (path);
--
-- Name: format_pkey; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY format
ADD CONSTRAINT format_pkey PRIMARY KEY (id);
--
-- Name: person_pkey; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY person
ADD CONSTRAINT person_pkey PRIMARY KEY (id);
--
-- Name: person_short_name_key; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY person
ADD CONSTRAINT person_short_name_key UNIQUE (short_name);
--
-- Name: picture_pkey; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY picture
ADD CONSTRAINT picture_pkey PRIMARY KEY (id);
--
-- Name: tag_name_key; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY tag
ADD CONSTRAINT tag_name_key UNIQUE (name);
--
-- Name: tag_pkey; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY tag
ADD CONSTRAINT tag_pkey PRIMARY KEY (id);
--
-- Name: umbra_role_name_key; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY umbra_role
ADD CONSTRAINT umbra_role_name_key UNIQUE (name);
--
-- Name: umbra_role_pkey; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY umbra_role
ADD CONSTRAINT umbra_role_pkey PRIMARY KEY (id);
--
-- Name: umbra_user_pkey; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY umbra_user
ADD CONSTRAINT umbra_user_pkey PRIMARY KEY (id);
--
-- Name: umbra_user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY umbra_user_roles
ADD CONSTRAINT umbra_user_roles_pkey PRIMARY KEY (user_id, role_id);
--
-- Name: umbra_user_username_key; Type: CONSTRAINT; Schema: public; Owner: umbra; Tablespace:
--
ALTER TABLE ONLY umbra_user
ADD CONSTRAINT umbra_user_username_key UNIQUE (username);
--
-- Name: fk244e41b6899b4c60; Type: FK CONSTRAINT; Schema: public; Owner: umbra
--
ALTER TABLE ONLY picture_person
ADD CONSTRAINT fk244e41b6899b4c60 FOREIGN KEY (person_id) REFERENCES person(id);
--
-- Name: fk244e41b6d228d1c2; Type: FK CONSTRAINT; Schema: public; Owner: umbra
--
ALTER TABLE ONLY picture_person
ADD CONSTRAINT fk244e41b6d228d1c2 FOREIGN KEY (picture_people_id) REFERENCES picture(id);
--
-- Name: fk26d47a312a0d2af4; Type: FK CONSTRAINT; Schema: public; Owner: umbra
--
ALTER TABLE ONLY entry_picture
ADD CONSTRAINT fk26d47a312a0d2af4 FOREIGN KEY (picture_id) REFERENCES picture(id);
--
-- Name: fk6af661167111ea20; Type: FK CONSTRAINT; Schema: public; Owner: umbra
--
ALTER TABLE ONLY umbra_user_permissions
ADD CONSTRAINT fk6af661167111ea20 FOREIGN KEY (user_id) REFERENCES umbra_user(id);
--
-- Name: fk6f3c4d41cbe72640; Type: FK CONSTRAINT; Schema: public; Owner: umbra
--
ALTER TABLE ONLY umbra_role_permissions
ADD CONSTRAINT fk6f3c4d41cbe72640 FOREIGN KEY (role_id) REFERENCES umbra_role(id);
--
-- Name: fka5c750cf7111ea20; Type: FK CONSTRAINT; Schema: public; Owner: umbra
--
ALTER TABLE ONLY umbra_user_roles
ADD CONSTRAINT fka5c750cf7111ea20 FOREIGN KEY (user_id) REFERENCES umbra_user(id);
--
-- Name: fka5c750cfcbe72640; Type: FK CONSTRAINT; Schema: public; Owner: umbra
--
ALTER TABLE ONLY umbra_user_roles
ADD CONSTRAINT fka5c750cfcbe72640 FOREIGN KEY (role_id) REFERENCES umbra_role(id);
--
-- Name: fkb45ff7f72a0d2af4; Type: FK CONSTRAINT; Schema: public; Owner: umbra
--
ALTER TABLE ONLY format
ADD CONSTRAINT fkb45ff7f72a0d2af4 FOREIGN KEY (picture_id) REFERENCES picture(id);
--
-- Name: fke3726e4d8514e274; Type: FK CONSTRAINT; Schema: public; Owner: umbra
--
ALTER TABLE ONLY entry_tag
ADD CONSTRAINT fke3726e4d8514e274 FOREIGN KEY (tag_id) REFERENCES tag(id);
--
-- Name: fke3726e4dad233920; Type: FK CONSTRAINT; Schema: public; Owner: umbra
--
ALTER TABLE ONLY entry_tag
ADD CONSTRAINT fke3726e4dad233920 FOREIGN KEY (entry_tags_id) REFERENCES entry(id);
--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
--
-- PostgreSQL database dump complete
--