File size: 8,425 Bytes
794500a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
--
-- PostgreSQL database dump
--

\restrict lUtXg8tmeCyIZ5oci1TsVpXqbqcocLeERyHGNxqpmewUVF1LCzrex3BnhXfyYmk

-- Dumped from database version 17.6
-- Dumped by pg_dump version 17.7 (Homebrew)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_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: community_reports; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.community_reports (
    id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL,
    user_email text,
    lat double precision NOT NULL,
    lon double precision NOT NULL,
    report_type text NOT NULL,
    description text,
    upvotes integer DEFAULT 0,
    verified boolean DEFAULT false
);


ALTER TABLE public.community_reports OWNER TO postgres;

--
-- Name: community_reports_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

ALTER TABLE public.community_reports ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.community_reports_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: feedback_logs; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.feedback_logs (
    id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL,
    user_email text,
    route_id bigint,
    sentiment text,
    user_comment text,
    chat_transcript text,
    context_weather_temp double precision
);


ALTER TABLE public.feedback_logs OWNER TO postgres;

--
-- Name: feedback_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

ALTER TABLE public.feedback_logs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.feedback_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: route_logs; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.route_logs (
    id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL,
    user_email text DEFAULT 'guest'::text,
    start_point text,
    end_point text,
    fast_dist_km double precision,
    cool_dist_km double precision,
    dist_diff_km double precision,
    shade_gain_pct integer,
    temp_c double precision,
    weather_station text,
    via_point text
);


ALTER TABLE public.route_logs OWNER TO postgres;

--
-- Name: route_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

ALTER TABLE public.route_logs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.route_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: sensor_logs; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.sensor_logs (
    id bigint NOT NULL,
    created_at timestamp with time zone DEFAULT timezone('utc'::text, now()) NOT NULL,
    user_id text,
    wbgt_value double precision,
    lat double precision,
    lon double precision,
    notes text,
    nea_temp double precision,
    weather_station text
);


ALTER TABLE public.sensor_logs OWNER TO postgres;

--
-- Name: sensor_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

ALTER TABLE public.sensor_logs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.sensor_logs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: community_reports community_reports_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.community_reports
    ADD CONSTRAINT community_reports_pkey PRIMARY KEY (id);


--
-- Name: feedback_logs feedback_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.feedback_logs
    ADD CONSTRAINT feedback_logs_pkey PRIMARY KEY (id);


--
-- Name: route_logs route_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.route_logs
    ADD CONSTRAINT route_logs_pkey PRIMARY KEY (id);


--
-- Name: sensor_logs sensor_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.sensor_logs
    ADD CONSTRAINT sensor_logs_pkey PRIMARY KEY (id);


--
-- Name: feedback_logs Allow all inserts; Type: POLICY; Schema: public; Owner: postgres
--

CREATE POLICY "Allow all inserts" ON public.feedback_logs FOR INSERT WITH CHECK (true);


--
-- Name: sensor_logs Allow authenticated users to insert logs; Type: POLICY; Schema: public; Owner: postgres
--

CREATE POLICY "Allow authenticated users to insert logs" ON public.sensor_logs FOR INSERT TO authenticated WITH CHECK (true);


--
-- Name: route_logs Public Insert Logs; Type: POLICY; Schema: public; Owner: postgres
--

CREATE POLICY "Public Insert Logs" ON public.route_logs FOR INSERT WITH CHECK (true);


--
-- Name: community_reports Public Insert Reports; Type: POLICY; Schema: public; Owner: postgres
--

CREATE POLICY "Public Insert Reports" ON public.community_reports FOR INSERT WITH CHECK (true);


--
-- Name: route_logs Public Read Logs; Type: POLICY; Schema: public; Owner: postgres
--

CREATE POLICY "Public Read Logs" ON public.route_logs FOR SELECT USING (true);


--
-- Name: community_reports Public Read Reports; Type: POLICY; Schema: public; Owner: postgres
--

CREATE POLICY "Public Read Reports" ON public.community_reports FOR SELECT USING (true);


--
-- Name: community_reports; Type: ROW SECURITY; Schema: public; Owner: postgres
--

ALTER TABLE public.community_reports ENABLE ROW LEVEL SECURITY;

--
-- Name: route_logs; Type: ROW SECURITY; Schema: public; Owner: postgres
--

ALTER TABLE public.route_logs ENABLE ROW LEVEL SECURITY;

--
-- Name: sensor_logs; Type: ROW SECURITY; Schema: public; Owner: postgres
--

ALTER TABLE public.sensor_logs ENABLE ROW LEVEL SECURITY;

--
-- Name: TABLE community_reports; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON TABLE public.community_reports TO anon;
GRANT ALL ON TABLE public.community_reports TO authenticated;
GRANT ALL ON TABLE public.community_reports TO service_role;


--
-- Name: SEQUENCE community_reports_id_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON SEQUENCE public.community_reports_id_seq TO anon;
GRANT ALL ON SEQUENCE public.community_reports_id_seq TO authenticated;
GRANT ALL ON SEQUENCE public.community_reports_id_seq TO service_role;


--
-- Name: TABLE feedback_logs; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON TABLE public.feedback_logs TO anon;
GRANT ALL ON TABLE public.feedback_logs TO authenticated;
GRANT ALL ON TABLE public.feedback_logs TO service_role;


--
-- Name: SEQUENCE feedback_logs_id_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON SEQUENCE public.feedback_logs_id_seq TO anon;
GRANT ALL ON SEQUENCE public.feedback_logs_id_seq TO authenticated;
GRANT ALL ON SEQUENCE public.feedback_logs_id_seq TO service_role;


--
-- Name: TABLE route_logs; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON TABLE public.route_logs TO anon;
GRANT ALL ON TABLE public.route_logs TO authenticated;
GRANT ALL ON TABLE public.route_logs TO service_role;


--
-- Name: SEQUENCE route_logs_id_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON SEQUENCE public.route_logs_id_seq TO anon;
GRANT ALL ON SEQUENCE public.route_logs_id_seq TO authenticated;
GRANT ALL ON SEQUENCE public.route_logs_id_seq TO service_role;


--
-- Name: TABLE sensor_logs; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON TABLE public.sensor_logs TO anon;
GRANT ALL ON TABLE public.sensor_logs TO authenticated;
GRANT ALL ON TABLE public.sensor_logs TO service_role;


--
-- Name: SEQUENCE sensor_logs_id_seq; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON SEQUENCE public.sensor_logs_id_seq TO anon;
GRANT ALL ON SEQUENCE public.sensor_logs_id_seq TO authenticated;
GRANT ALL ON SEQUENCE public.sensor_logs_id_seq TO service_role;


--
-- PostgreSQL database dump complete
--

\unrestrict lUtXg8tmeCyIZ5oci1TsVpXqbqcocLeERyHGNxqpmewUVF1LCzrex3BnhXfyYmk