-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal_backup.sql
416 lines (294 loc) · 12.5 KB
/
local_backup.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
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.15 (Homebrew)
-- Dumped by pg_dump version 14.15 (Homebrew)
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;
ALTER TABLE IF EXISTS ONLY public.rides DROP CONSTRAINT IF EXISTS rides_creator_id_fkey;
ALTER TABLE IF EXISTS ONLY public.ride_requests DROP CONSTRAINT IF EXISTS ride_requests_ride_id_fkey;
ALTER TABLE IF EXISTS ONLY public.ride_requests DROP CONSTRAINT IF EXISTS ride_requests_requester_id_fkey;
ALTER TABLE IF EXISTS ONLY public.ride_participants DROP CONSTRAINT IF EXISTS ride_participants_user_id_fkey;
ALTER TABLE IF EXISTS ONLY public.ride_participants DROP CONSTRAINT IF EXISTS ride_participants_ride_id_fkey;
ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT IF EXISTS users_pkey;
ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT IF EXISTS users_netid_key;
ALTER TABLE IF EXISTS ONLY public.users DROP CONSTRAINT IF EXISTS users_email_key;
ALTER TABLE IF EXISTS ONLY public.rides DROP CONSTRAINT IF EXISTS rides_pkey;
ALTER TABLE IF EXISTS ONLY public.ride_requests DROP CONSTRAINT IF EXISTS ride_requests_pkey;
ALTER TABLE IF EXISTS ONLY public.ride_participants DROP CONSTRAINT IF EXISTS ride_participants_ride_id_user_id_key;
ALTER TABLE IF EXISTS ONLY public.ride_participants DROP CONSTRAINT IF EXISTS ride_participants_pkey;
ALTER TABLE IF EXISTS public.users ALTER COLUMN id DROP DEFAULT;
ALTER TABLE IF EXISTS public.rides ALTER COLUMN id DROP DEFAULT;
ALTER TABLE IF EXISTS public.ride_requests ALTER COLUMN id DROP DEFAULT;
ALTER TABLE IF EXISTS public.ride_participants ALTER COLUMN id DROP DEFAULT;
DROP SEQUENCE IF EXISTS public.users_id_seq;
DROP TABLE IF EXISTS public.users;
DROP SEQUENCE IF EXISTS public.rides_id_seq;
DROP TABLE IF EXISTS public.rides;
DROP SEQUENCE IF EXISTS public.ride_requests_id_seq;
DROP TABLE IF EXISTS public.ride_requests;
DROP SEQUENCE IF EXISTS public.ride_participants_id_seq;
DROP TABLE IF EXISTS public.ride_participants;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: ride_participants; Type: TABLE; Schema: public; Owner: erikdyer
--
CREATE TABLE public.ride_participants (
id integer NOT NULL,
ride_id integer,
user_id integer,
joined_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);
ALTER TABLE public.ride_participants OWNER TO erikdyer;
--
-- Name: ride_participants_id_seq; Type: SEQUENCE; Schema: public; Owner: erikdyer
--
CREATE SEQUENCE public.ride_participants_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.ride_participants_id_seq OWNER TO erikdyer;
--
-- Name: ride_participants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: erikdyer
--
ALTER SEQUENCE public.ride_participants_id_seq OWNED BY public.ride_participants.id;
--
-- Name: ride_requests; Type: TABLE; Schema: public; Owner: erikdyer
--
CREATE TABLE public.ride_requests (
id integer NOT NULL,
ride_id integer,
requester_id integer,
status character varying(20) DEFAULT 'pending'::character varying,
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP
);
ALTER TABLE public.ride_requests OWNER TO erikdyer;
--
-- Name: ride_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: erikdyer
--
CREATE SEQUENCE public.ride_requests_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.ride_requests_id_seq OWNER TO erikdyer;
--
-- Name: ride_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: erikdyer
--
ALTER SEQUENCE public.ride_requests_id_seq OWNED BY public.ride_requests.id;
--
-- Name: rides; Type: TABLE; Schema: public; Owner: erikdyer
--
CREATE TABLE public.rides (
id integer NOT NULL,
creator_id integer,
destination character varying(255) NOT NULL,
departure_time timestamp with time zone NOT NULL,
available_seats integer NOT NULL,
notes text,
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
status character varying(50) DEFAULT 'active'::character varying,
total_fare numeric(10,2),
fare_per_person numeric(10,2) GENERATED ALWAYS AS (
CASE
WHEN (available_seats > 0) THEN (total_fare / ((available_seats + 1))::numeric)
ELSE total_fare
END) STORED
);
ALTER TABLE public.rides OWNER TO erikdyer;
--
-- Name: rides_id_seq; Type: SEQUENCE; Schema: public; Owner: erikdyer
--
CREATE SEQUENCE public.rides_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.rides_id_seq OWNER TO erikdyer;
--
-- Name: rides_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: erikdyer
--
ALTER SEQUENCE public.rides_id_seq OWNED BY public.rides.id;
--
-- Name: users; Type: TABLE; Schema: public; Owner: erikdyer
--
CREATE TABLE public.users (
id integer NOT NULL,
netid character varying(50) NOT NULL,
email character varying(255) NOT NULL,
full_name character varying(255) NOT NULL,
created_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
phone character varying(20),
phone_verified boolean DEFAULT false,
phone_number character varying(20)
);
ALTER TABLE public.users OWNER TO erikdyer;
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: erikdyer
--
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 erikdyer;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: erikdyer
--
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
--
-- Name: ride_participants id; Type: DEFAULT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.ride_participants ALTER COLUMN id SET DEFAULT nextval('public.ride_participants_id_seq'::regclass);
--
-- Name: ride_requests id; Type: DEFAULT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.ride_requests ALTER COLUMN id SET DEFAULT nextval('public.ride_requests_id_seq'::regclass);
--
-- Name: rides id; Type: DEFAULT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.rides ALTER COLUMN id SET DEFAULT nextval('public.rides_id_seq'::regclass);
--
-- Name: users id; Type: DEFAULT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
--
-- Data for Name: ride_participants; Type: TABLE DATA; Schema: public; Owner: erikdyer
--
COPY public.ride_participants (id, ride_id, user_id, joined_at) FROM stdin;
16 14 1 2025-01-05 19:45:38.880766-05
\.
--
-- Data for Name: ride_requests; Type: TABLE DATA; Schema: public; Owner: erikdyer
--
COPY public.ride_requests (id, ride_id, requester_id, status, created_at, updated_at) FROM stdin;
12 15 3 pending 2025-01-05 19:45:24.958774-05 2025-01-05 19:45:24.958774-05
11 14 1 approved 2025-01-05 19:44:56.326277-05 2025-01-05 19:44:56.326277-05
\.
--
-- Data for Name: rides; Type: TABLE DATA; Schema: public; Owner: erikdyer
--
COPY public.rides (id, creator_id, destination, departure_time, available_seats, notes, created_at, status, total_fare) FROM stdin;
2 2 Newark Airport 2024-12-31 14:00:00-05 2 Direct to Terminal B 2024-12-29 16:54:01.843016-05 active \N
4 3 trenton 2? 2024-12-29 13:30:00-05 2 test123 2024-12-29 22:00:59.992812-05 cancelled \N
5 3 JFK Airport 2024-12-30 12:15:00-05 3 2024-12-30 02:45:24.723942-05 cancelled 25.00
6 3 JFK Airport 2024-12-31 12:15:00-05 3 2024-12-30 18:00:00.801992-05 cancelled 25.00
7 3 JFK Airport 2024-12-31 12:20:00-05 3 terminal 2 2024-12-30 22:17:28.242154-05 cancelled 35.00
8 3 JFK Airport 2024-12-31 12:30:00-05 3 test123 2024-12-30 22:37:53.349328-05 cancelled 25.00
9 3 JFK Airport 2024-12-31 12:45:00-05 3 test1234 2024-12-30 22:40:49.448071-05 cancelled 25.00
10 3 JFK Airport 2024-12-31 12:30:00-05 3 test123 2024-12-31 03:10:51.478496-05 cancelled 42.00
11 3 JFK Airport 2025-03-31 13:30:00-04 3 123 2024-12-31 03:13:42.869875-05 cancelled 25.00
12 3 Newark Airport 2024-12-31 12:30:00-05 3 2024-12-31 03:29:45.805474-05 cancelled 25.00
13 3 JFK Airport 2025-12-31 13:00:00-05 3 test123 2024-12-31 16:01:27.513472-05 cancelled 25.00
16 3 JFK Airport 2025-01-10 13:30:00-05 4 Testing 2025-01-06 03:08:53.834648-05 cancelled 30.00
14 3 JFK Airport 2025-01-05 21:00:00-05 4 test 2025-01-05 19:44:43.074489-05 cancelled 30.00
15 1 LaGuardia Airport 2025-05-02 13:30:00-04 2 a 2025-01-05 19:45:19.813767-05 cancelled 25.00
1 1 JFK Airport 2024-12-30 10:00:00-05 3 Terminal 4 departure 2024-12-29 16:54:01.843016-05 cancelled \N
3 1 Trenton 2024-12-29 13:00:00-05 3 2024-12-29 21:30:09.097385-05 cancelled \N
\.
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: erikdyer
--
COPY public.users (id, netid, email, full_name, created_at, phone, phone_verified, phone_number) FROM stdin;
1 test123 [email protected] Test User 2024-12-29 16:53:57.479782-05 \N f \N
3 ed1783 [email protected] ed1783 2024-12-29 21:58:18.95496-05 \N f 8138952544
2 tiger456 [email protected] Tiger Tester 2024-12-29 16:53:57.479782-05 \N f \N
\.
--
-- Name: ride_participants_id_seq; Type: SEQUENCE SET; Schema: public; Owner: erikdyer
--
SELECT pg_catalog.setval('public.ride_participants_id_seq', 17, true);
--
-- Name: ride_requests_id_seq; Type: SEQUENCE SET; Schema: public; Owner: erikdyer
--
SELECT pg_catalog.setval('public.ride_requests_id_seq', 12, true);
--
-- Name: rides_id_seq; Type: SEQUENCE SET; Schema: public; Owner: erikdyer
--
SELECT pg_catalog.setval('public.rides_id_seq', 16, true);
--
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: erikdyer
--
SELECT pg_catalog.setval('public.users_id_seq', 3, true);
--
-- Name: ride_participants ride_participants_pkey; Type: CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.ride_participants
ADD CONSTRAINT ride_participants_pkey PRIMARY KEY (id);
--
-- Name: ride_participants ride_participants_ride_id_user_id_key; Type: CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.ride_participants
ADD CONSTRAINT ride_participants_ride_id_user_id_key UNIQUE (ride_id, user_id);
--
-- Name: ride_requests ride_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.ride_requests
ADD CONSTRAINT ride_requests_pkey PRIMARY KEY (id);
--
-- Name: rides rides_pkey; Type: CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.rides
ADD CONSTRAINT rides_pkey PRIMARY KEY (id);
--
-- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_email_key UNIQUE (email);
--
-- Name: users users_netid_key; Type: CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_netid_key UNIQUE (netid);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: ride_participants ride_participants_ride_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.ride_participants
ADD CONSTRAINT ride_participants_ride_id_fkey FOREIGN KEY (ride_id) REFERENCES public.rides(id);
--
-- Name: ride_participants ride_participants_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.ride_participants
ADD CONSTRAINT ride_participants_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
--
-- Name: ride_requests ride_requests_requester_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.ride_requests
ADD CONSTRAINT ride_requests_requester_id_fkey FOREIGN KEY (requester_id) REFERENCES public.users(id);
--
-- Name: ride_requests ride_requests_ride_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.ride_requests
ADD CONSTRAINT ride_requests_ride_id_fkey FOREIGN KEY (ride_id) REFERENCES public.rides(id);
--
-- Name: rides rides_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: erikdyer
--
ALTER TABLE ONLY public.rides
ADD CONSTRAINT rides_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES public.users(id);
--
-- PostgreSQL database dump complete
--