-
Notifications
You must be signed in to change notification settings - Fork 0
/
crwn-db.sql
355 lines (248 loc) · 9.46 KB
/
crwn-db.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
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.2
-- Dumped by pg_dump version 14.2
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;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: categories; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.categories (
id bigint NOT NULL,
title text NOT NULL,
active boolean DEFAULT true NOT NULL,
image_url text
);
ALTER TABLE public.categories OWNER TO postgres;
--
-- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
ALTER TABLE public.categories ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
SEQUENCE NAME public.categories_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- Name: products; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.products (
id bigint NOT NULL,
category bigint NOT NULL,
name text NOT NULL,
price numeric(5,2) NOT NULL,
image_url text
);
ALTER TABLE public.products OWNER TO postgres;
--
-- Name: products_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
ALTER TABLE public.products ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
SEQUENCE NAME public.products_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- Name: users; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.users (
id bigint NOT NULL,
googleid numeric(30,0),
display_name text NOT NULL,
email text NOT NULL,
password text,
created_at timestamp without time zone DEFAULT now() NOT NULL,
updated_at timestamp without time zone,
permissions json DEFAULT '{ "users": "self", "products": "R" }'::json
);
ALTER TABLE public.users OWNER TO postgres;
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
ALTER TABLE public.users ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY (
SEQUENCE NAME public.users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- Data for Name: categories; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.categories (id, title, active, image_url) FROM stdin;
1 hats t https://i.ibb.co/cvpntL1/hats.png
2 jackets t https://i.ibb.co/px2tCc3/jackets.png
3 mens t https://i.ibb.co/R70vBrQ/men.png
4 sneakers t https://i.ibb.co/0jqHpnp/sneakers.png
5 womens t https://i.ibb.co/GCCdy8t/womens.png
\.
--
-- Data for Name: products; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.products (id, category, name, price, image_url) FROM stdin;
1 1 Brown Brim 25.00 https://i.ibb.co/ZYW3VTp/brown-brim.png
2 1 Blue Beanie 18.00 https://i.ibb.co/ypkgK0X/blue-beanie.png
3 1 Brown Cowboy 35.00 https://i.ibb.co/QdJwgmp/brown-cowboy.png
4 1 Grey Brim 25.00 https://i.ibb.co/RjBLWxB/grey-brim.png
5 1 Green Beanie 18.00 https://i.ibb.co/YTjW3vF/green-beanie.png
6 1 Palm Tree Cap 14.00 https://i.ibb.co/rKBDvJX/palm-tree-cap.png
7 1 Red Beanie 18.00 https://i.ibb.co/bLB646Z/red-beanie.png
8 1 Wolf Cap 14.00 https://i.ibb.co/1f2nWMM/wolf-cap.png
9 1 Blue Snapback 16.00 https://i.ibb.co/X2VJP2W/blue-snapback.png
10 4 Adidas NMD 220.00 https://i.ibb.co/0s3pdnc/adidas-nmd.png
11 4 Adidas Yeezy 280.00 https://i.ibb.co/dJbG1cT/yeezy.png
12 4 Black Converse 110.00 https://i.ibb.co/bPmVXyP/black-converse.png
13 4 Nike White AirForce 160.00 https://i.ibb.co/1RcFPk0/white-nike-high-tops.png
14 4 Nike Red High Tops 160.00 https://i.ibb.co/QcvzydB/nikes-red.png
15 4 Nike Brown High Tops 160.00 https://i.ibb.co/fMTV342/nike-brown.png
16 4 Air Jordan Limited 190.00 https://i.ibb.co/w4k6Ws9/nike-funky.png
17 4 Timberlands 200.00 https://i.ibb.co/Mhh6wBg/timberlands.png
18 2 Black Jean Shearling 125.00 https://i.ibb.co/XzcwL5s/black-shearling.png
19 2 Blue Jean Jacket 90.00 https://i.ibb.co/mJS6vz0/blue-jean-jacket.png
20 2 Grey Jean Jacket 90.00 https://i.ibb.co/N71k1ML/grey-jean-jacket.png
21 2 Brown Shearling 165.00 https://i.ibb.co/s96FpdP/brown-shearling.png
22 2 Tan Trench 185.00 https://i.ibb.co/M6hHc3F/brown-trench.png
23 5 Blue Tanktop 25.00 https://i.ibb.co/7CQVJNm/blue-tank.png
24 5 Floral Blouse 20.00 https://i.ibb.co/4W2DGKm/floral-blouse.png
25 5 Floral Dress 80.00 https://i.ibb.co/KV18Ysr/floral-skirt.png
26 5 Red Dots Dress 80.00 https://i.ibb.co/N3BN1bh/red-polka-dot-dress.png
27 5 Striped Sweater 45.00 https://i.ibb.co/KmSkMbH/striped-sweater.png
28 5 Yellow Track Suit 135.00 https://i.ibb.co/v1cvwNf/yellow-track-suit.png
29 5 White Blouse 20.00 https://i.ibb.co/qBcrsJg/white-vest.png
30 3 Camo Down Vest 325.00 https://i.ibb.co/xJS0T3Y/camo-vest.png
31 3 Floral T-shirt 20.00 https://i.ibb.co/qMQ75QZ/floral-shirt.png
32 3 Black & White Longsleeve 25.00 https://i.ibb.co/55z32tw/long-sleeve.png
33 3 Pink T-shirt 25.00 https://i.ibb.co/RvwnBL8/pink-shirt.png
34 3 Jean Long Sleeve 40.00 https://i.ibb.co/VpW4x5t/roll-up-jean-shirt.png
35 3 Burgundy T-shirt 25.00 https://i.ibb.co/mh3VM1f/polka-dot-shirt.png
\.
--
-- Name: categories_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.categories_id_seq', 6, true);
--
-- Name: products_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.products_id_seq', 35, true);
--
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.users_id_seq', 4, true);
--
-- Name: categories categories_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.categories
ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
--
-- Name: categories categories_title_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.categories
ADD CONSTRAINT categories_title_key UNIQUE (title);
--
-- Name: products products_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.products
ADD CONSTRAINT products_pkey PRIMARY KEY (id);
--
-- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_email_key UNIQUE (email);
--
-- Name: users users_googleid_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_googleid_key UNIQUE (googleid);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: products fk_category; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.products
ADD CONSTRAINT fk_category FOREIGN KEY (category) REFERENCES public.categories(id);
--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: crwn-admin
--
REVOKE ALL ON SCHEMA public FROM postgres;
REVOKE ALL ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO PUBLIC;
GRANT ALL ON SCHEMA public TO "crwn-admin";
--
-- Name: TABLE categories; Type: ACL; Schema: public; Owner: postgres
--
GRANT ALL ON TABLE public.categories TO "crwn-admin";
--
-- Name: SEQUENCE categories_id_seq; Type: ACL; Schema: public; Owner: postgres
--
GRANT ALL ON SEQUENCE public.categories_id_seq TO "crwn-admin";
--
-- Name: TABLE products; Type: ACL; Schema: public; Owner: postgres
--
GRANT ALL ON TABLE public.products TO "crwn-admin";
--
-- Name: SEQUENCE products_id_seq; Type: ACL; Schema: public; Owner: postgres
--
GRANT ALL ON SEQUENCE public.products_id_seq TO "crwn-admin";
--
-- Name: TABLE users; Type: ACL; Schema: public; Owner: postgres
--
GRANT ALL ON TABLE public.users TO "crwn-admin";
--
-- Name: SEQUENCE users_id_seq; Type: ACL; Schema: public; Owner: postgres
--
GRANT ALL ON SEQUENCE public.users_id_seq TO "crwn-admin";
--
-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: postgres
--
ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO "crwn-admin";
--
-- Name: DEFAULT PRIVILEGES FOR TYPES; Type: DEFAULT ACL; Schema: public; Owner: postgres
--
ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TYPES TO "crwn-admin";
--
-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: postgres
--
ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO "crwn-admin";
--
-- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: postgres
--
ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO "crwn-admin";
--
-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: -; Owner: postgres
--
ALTER DEFAULT PRIVILEGES FOR ROLE postgres GRANT ALL ON SEQUENCES TO "crwn-admin";
--
-- Name: DEFAULT PRIVILEGES FOR TYPES; Type: DEFAULT ACL; Schema: -; Owner: postgres
--
ALTER DEFAULT PRIVILEGES FOR ROLE postgres GRANT ALL ON TYPES TO "crwn-admin";
--
-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: -; Owner: postgres
--
ALTER DEFAULT PRIVILEGES FOR ROLE postgres GRANT ALL ON FUNCTIONS TO "crwn-admin";
--
-- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: -; Owner: postgres
--
ALTER DEFAULT PRIVILEGES FOR ROLE postgres GRANT ALL ON TABLES TO "crwn-admin";
--
-- PostgreSQL database dump complete
--