-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.sql
310 lines (210 loc) · 7.05 KB
/
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
--
-- PostgreSQL database dump
--
-- Dumped from database version 11.2
-- Dumped by pg_dump version 11.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 client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: items; Type: TABLE; Schema: public; Owner: boomtown
--
CREATE TABLE public.items (
id integer NOT NULL,
title text DEFAULT 'No title added'::text NOT NULL,
imageurl text DEFAULT 'http://via.placeholder.com/350x250?text=Please+select+an+image'::text,
description text DEFAULT 'No description added'::text NOT NULL,
ownerid integer,
borrowerid integer,
created timestamp without time zone DEFAULT now(),
CONSTRAINT items_check CHECK ((borrowerid <> ownerid))
);
ALTER TABLE public.items OWNER TO boomtown;
--
-- Name: items_id_seq; Type: SEQUENCE; Schema: public; Owner: boomtown
--
CREATE SEQUENCE public.items_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.items_id_seq OWNER TO boomtown;
--
-- Name: items_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: boomtown
--
ALTER SEQUENCE public.items_id_seq OWNED BY public.items.id;
--
-- Name: itemtags; Type: TABLE; Schema: public; Owner: boomtown
--
CREATE TABLE public.itemtags (
itemid integer NOT NULL,
tagid integer NOT NULL
);
ALTER TABLE public.itemtags OWNER TO boomtown;
--
-- Name: tags; Type: TABLE; Schema: public; Owner: boomtown
--
CREATE TABLE public.tags (
id integer NOT NULL,
title text NOT NULL
);
ALTER TABLE public.tags OWNER TO boomtown;
--
-- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: boomtown
--
CREATE SEQUENCE public.tags_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.tags_id_seq OWNER TO boomtown;
--
-- Name: tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: boomtown
--
ALTER SEQUENCE public.tags_id_seq OWNED BY public.tags.id;
--
-- Name: users; Type: TABLE; Schema: public; Owner: boomtown
--
CREATE TABLE public.users (
id integer NOT NULL,
email text NOT NULL,
fullname text NOT NULL,
bio text DEFAULT 'No bio added'::text,
password text
);
ALTER TABLE public.users OWNER TO boomtown;
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: boomtown
--
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 boomtown;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: boomtown
--
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
--
-- Name: items id; Type: DEFAULT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.items ALTER COLUMN id SET DEFAULT nextval('public.items_id_seq'::regclass);
--
-- Name: tags id; Type: DEFAULT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.tags ALTER COLUMN id SET DEFAULT nextval('public.tags_id_seq'::regclass);
--
-- Name: users id; Type: DEFAULT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
--
-- Data for Name: items; Type: TABLE DATA; Schema: public; Owner: boomtown
--
COPY public.items (id, title, imageurl, description, ownerid, borrowerid, created) FROM stdin;
64 White Soapstone https://i.etsystatic.com/20123502/c/2361/1875/317/208/il/5336a3/1910936697/il_340x270.1910936697_54tc.jpg Let me join you for some jolly cooperation! 17 \N 2019-06-04 10:50:12.587172
67 Wooden Mug https://i.etsystatic.com/13323094/r/il/a919f7/1006514292/il_570xN.1006514292_qdj4.jpg Join me for a drink friend! 18 \N 2019-06-04 11:42:43.497599
68 Sunlight Medal https://i.etsystatic.com/6963080/r/il/ae67df/1378740166/il_794xN.1378740166_qq9o.jpg Medal given to warriors of the sun as reward 17 \N 2019-06-04 11:43:24.860282
\.
--
-- Data for Name: itemtags; Type: TABLE DATA; Schema: public; Owner: boomtown
--
COPY public.itemtags (itemid, tagid) FROM stdin;
64 2
64 2
67 1
68 1
\.
--
-- Data for Name: tags; Type: TABLE DATA; Schema: public; Owner: boomtown
--
COPY public.tags (id, title) FROM stdin;
1 Household Items
2 Tools
3 Electronics
4 Physical Media
5 Sporting Goods
6 Musical Instruments
7 Recreational Equipment
\.
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: boomtown
--
COPY public.users (id, email, fullname, bio, password) FROM stdin;
17 [email protected] SunBro No bio added $2a$10$BWmKyxTLdtZBl.s7i5LVyu48f3AAkCP8GezEiO3rtUlbD8RrPNHw6
18 [email protected] OnionKnight No bio added $2a$10$NzH5eIwWosbpyTmiQb6e9uIJ2jKT04.m3yfT1ksnxB/v6KtWlbkjy
\.
--
-- Name: items_id_seq; Type: SEQUENCE SET; Schema: public; Owner: boomtown
--
SELECT pg_catalog.setval('public.items_id_seq', 68, true);
--
-- Name: tags_id_seq; Type: SEQUENCE SET; Schema: public; Owner: boomtown
--
SELECT pg_catalog.setval('public.tags_id_seq', 8, true);
--
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: boomtown
--
SELECT pg_catalog.setval('public.users_id_seq', 18, true);
--
-- Name: items items_pkey; Type: CONSTRAINT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.items
ADD CONSTRAINT items_pkey PRIMARY KEY (id);
--
-- Name: tags tags_name_key; Type: CONSTRAINT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.tags
ADD CONSTRAINT tags_name_key UNIQUE (title);
--
-- Name: tags tags_pkey; Type: CONSTRAINT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.tags
ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
--
-- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_email_key UNIQUE (email);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: items items_borrowerid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.items
ADD CONSTRAINT items_borrowerid_fkey FOREIGN KEY (borrowerid) REFERENCES public.users(id);
--
-- Name: items items_ownerid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.items
ADD CONSTRAINT items_ownerid_fkey FOREIGN KEY (ownerid) REFERENCES public.users(id) ON DELETE CASCADE;
--
-- Name: itemtags itemtags_itemid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.itemtags
ADD CONSTRAINT itemtags_itemid_fkey FOREIGN KEY (itemid) REFERENCES public.items(id) ON DELETE CASCADE;
--
-- Name: itemtags itemtags_tagid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: boomtown
--
ALTER TABLE ONLY public.itemtags
ADD CONSTRAINT itemtags_tagid_fkey FOREIGN KEY (tagid) REFERENCES public.tags(id) ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--