-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlilac.sql
301 lines (206 loc) · 7.25 KB
/
lilac.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
--
-- PostgreSQL database dump
--
-- Dumped from database version 11.5
-- Dumped by pg_dump version 11.5
-- Started on 2020-02-25 10:22:52 MST
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 10 (class 2615 OID 29296)
-- Name: lilac; Type: SCHEMA; Schema: -; Owner: postgres
--
CREATE SCHEMA lilac;
ALTER SCHEMA lilac OWNER TO postgres;
--
-- TOC entry 3257 (class 0 OID 0)
-- Dependencies: 10
-- Name: SCHEMA lilac; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON SCHEMA lilac IS 'standard lilac schema';
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 203 (class 1259 OID 29297)
-- Name: author; Type: TABLE; Schema: lilac; Owner: postgres
--
CREATE TABLE lilac.author (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
name text
);
ALTER TABLE lilac.author OWNER TO postgres;
--
-- TOC entry 210 (class 1259 OID 37448)
-- Name: author_comment; Type: TABLE; Schema: lilac; Owner: postgres
--
CREATE TABLE lilac.author_comment (
comment_id uuid NOT NULL,
author_id uuid NOT NULL
);
ALTER TABLE lilac.author_comment OWNER TO postgres;
--
-- TOC entry 207 (class 1259 OID 29373)
-- Name: author_post; Type: TABLE; Schema: lilac; Owner: postgres
--
CREATE TABLE lilac.author_post (
post_id uuid NOT NULL,
author_id uuid NOT NULL
);
ALTER TABLE lilac.author_post OWNER TO postgres;
--
-- TOC entry 204 (class 1259 OID 29311)
-- Name: comment; Type: TABLE; Schema: lilac; Owner: postgres
--
CREATE TABLE lilac.comment (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
text text,
submission_time timestamp with time zone NOT NULL
);
ALTER TABLE lilac.comment OWNER TO postgres;
--
-- TOC entry 208 (class 1259 OID 29388)
-- Name: comment_post; Type: TABLE; Schema: lilac; Owner: postgres
--
CREATE TABLE lilac.comment_post (
post_id uuid NOT NULL,
comment_id uuid NOT NULL
);
ALTER TABLE lilac.comment_post OWNER TO postgres;
--
-- TOC entry 205 (class 1259 OID 29318)
-- Name: image; Type: TABLE; Schema: lilac; Owner: postgres
--
CREATE TABLE lilac.image (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
size integer NOT NULL,
url text
);
ALTER TABLE lilac.image OWNER TO postgres;
--
-- TOC entry 209 (class 1259 OID 29403)
-- Name: image_post; Type: TABLE; Schema: lilac; Owner: postgres
--
CREATE TABLE lilac.image_post (
post_id uuid NOT NULL,
image_id uuid NOT NULL
);
ALTER TABLE lilac.image_post OWNER TO postgres;
--
-- TOC entry 206 (class 1259 OID 29325)
-- Name: post; Type: TABLE; Schema: lilac; Owner: postgres
--
CREATE TABLE lilac.post (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
title text,
markdown text,
submission_date timestamp with time zone NOT NULL
);
ALTER TABLE lilac.post OWNER TO postgres;
--
-- TOC entry 3108 (class 2606 OID 29333)
-- Name: author PK_Authors; Type: CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.author
ADD CONSTRAINT "PK_Authors" PRIMARY KEY (id);
--
-- TOC entry 3110 (class 2606 OID 29337)
-- Name: comment PK_Comments; Type: CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.comment
ADD CONSTRAINT "PK_Comments" PRIMARY KEY (id);
--
-- TOC entry 3112 (class 2606 OID 29339)
-- Name: image PK_Images; Type: CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.image
ADD CONSTRAINT "PK_Images" PRIMARY KEY (id);
--
-- TOC entry 3114 (class 2606 OID 29341)
-- Name: post PK_Posts; Type: CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.post
ADD CONSTRAINT "PK_Posts" PRIMARY KEY (id);
--
-- TOC entry 3122 (class 2606 OID 37452)
-- Name: author_comment author_comment_pkey; Type: CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.author_comment
ADD CONSTRAINT author_comment_pkey PRIMARY KEY (author_id, comment_id);
--
-- TOC entry 3116 (class 2606 OID 29377)
-- Name: author_post author_post_pkey; Type: CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.author_post
ADD CONSTRAINT author_post_pkey PRIMARY KEY (author_id, post_id);
--
-- TOC entry 3118 (class 2606 OID 29392)
-- Name: comment_post comment_post_pkey; Type: CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.comment_post
ADD CONSTRAINT comment_post_pkey PRIMARY KEY (comment_id, post_id);
--
-- TOC entry 3120 (class 2606 OID 29407)
-- Name: image_post image_post_pkey; Type: CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.image_post
ADD CONSTRAINT image_post_pkey PRIMARY KEY (image_id, post_id);
--
-- TOC entry 3129 (class 2606 OID 37453)
-- Name: author_comment author_comment_author_id_fkey; Type: FK CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.author_comment
ADD CONSTRAINT author_comment_author_id_fkey FOREIGN KEY (author_id) REFERENCES lilac.author(id) ON UPDATE CASCADE;
--
-- TOC entry 3130 (class 2606 OID 37458)
-- Name: author_comment author_comment_comment_id_fkey; Type: FK CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.author_comment
ADD CONSTRAINT author_comment_comment_id_fkey FOREIGN KEY (comment_id) REFERENCES lilac.comment(id) ON UPDATE CASCADE;
--
-- TOC entry 3124 (class 2606 OID 29383)
-- Name: author_post author_post_author_id_fkey; Type: FK CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.author_post
ADD CONSTRAINT author_post_author_id_fkey FOREIGN KEY (author_id) REFERENCES lilac.author(id) ON UPDATE CASCADE;
--
-- TOC entry 3123 (class 2606 OID 29378)
-- Name: author_post author_post_post_id_fkey; Type: FK CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.author_post
ADD CONSTRAINT author_post_post_id_fkey FOREIGN KEY (post_id) REFERENCES lilac.post(id) ON UPDATE CASCADE;
--
-- TOC entry 3126 (class 2606 OID 29398)
-- Name: comment_post comment_post_comment_id_fkey; Type: FK CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.comment_post
ADD CONSTRAINT comment_post_comment_id_fkey FOREIGN KEY (comment_id) REFERENCES lilac.comment(id) ON UPDATE CASCADE;
--
-- TOC entry 3125 (class 2606 OID 29393)
-- Name: comment_post comment_post_post_id_fkey; Type: FK CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.comment_post
ADD CONSTRAINT comment_post_post_id_fkey FOREIGN KEY (post_id) REFERENCES lilac.post(id) ON UPDATE CASCADE;
--
-- TOC entry 3128 (class 2606 OID 29413)
-- Name: image_post image_post_image_id_fkey; Type: FK CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.image_post
ADD CONSTRAINT image_post_image_id_fkey FOREIGN KEY (image_id) REFERENCES lilac.image(id) ON UPDATE CASCADE;
--
-- TOC entry 3127 (class 2606 OID 29408)
-- Name: image_post image_post_post_id_fkey; Type: FK CONSTRAINT; Schema: lilac; Owner: postgres
--
ALTER TABLE ONLY lilac.image_post
ADD CONSTRAINT image_post_post_id_fkey FOREIGN KEY (post_id) REFERENCES lilac.post(id) ON UPDATE CASCADE;
-- Completed on 2020-02-25 10:22:53 MST
--
-- PostgreSQL database dump complete
--