Skip to content

Commit 86aab39

Browse files
authored
Merge pull request #298 from technologiestiftung/fix/staging-schema
fix/staging schema
2 parents c923b5c + 5dc0a34 commit 86aab39

7 files changed

+52
-7
lines changed

.github/workflows/deploy-to-supabase-production.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
- uses: supabase/setup-cli@v1
2424
with:
25-
version: 2.19.7
25+
version: 2.20.3
2626

2727
- run: |
2828
supabase link --project-ref $PRODUCTION_PROJECT_ID

.github/workflows/deploy-to-supabase-staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
- uses: supabase/setup-cli@v1
2424
with:
25-
version: 2.19.7
25+
version: 2.20.3
2626

2727
- run: |
2828
supabase link --project-ref $STAGING_PROJECT_ID

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,5 @@ sql/trees_trees_2022-11-09T12-28-18.sql
282282
sql/trees_bezirk_mitte_table_2022-11-08T16-32-58.sql
283283
sql/*.dump
284284
# user specific cursor rules
285-
.cursor/rules/*
285+
.cursor/rules/*
286+
.cursor/mcp.json

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
supabase-cli 2.19.7
1+
supabase-cli 2.20.3
22
direnv 2.35.0

supabase/config.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ project_id = "giessdenkiez-de-supabase"
77
port = 54321
88
# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API
99
# endpoints. public and storage are always included.
10-
schemas = []
11-
# Extra schemas to add to the search_path of every request.
12-
extra_search_path = ["extensions"]
10+
schemas = ["public", "storage", "graphql_public"]
11+
extra_search_path = ["public", "extensions"]
1312
# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size
1413
# for accidental or malicious requests.
1514
max_rows = 10000
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
CREATE OR REPLACE FUNCTION public.accumulated_weather_per_month(limit_monts integer) RETURNS TABLE(
2+
measure_day text,
3+
sum_precipitation_mm_per_sqm double precision,
4+
avg_temperature_celsius double precision,
5+
avg_pressure_msl double precision,
6+
sum_sunshine_minutes double precision,
7+
avg_wind_direction_deg double precision,
8+
avg_wind_speed_kmh double precision,
9+
avg_cloud_cover_percentage double precision,
10+
avg_dew_point_celcius double precision,
11+
avg_relative_humidity_percentage double precision,
12+
avg_visibility_m double precision,
13+
avg_wind_gust_direction_deg double precision,
14+
avg_wind_gust_speed_kmh double precision
15+
) LANGUAGE 'plpgsql' COST 100 VOLATILE PARALLEL UNSAFE ROWS 1000 AS $BODY$ BEGIN RETURN query
16+
SELECT to_char(daily_weather_data.measure_day, 'YYYY-MM'),
17+
sum(daily_weather_data.sum_precipitation_mm_per_sqm) AS sum_precipitation_mm_per_sqm,
18+
avg(daily_weather_data.avg_temperature_celsius) AS avg_temperature_celsius,
19+
avg(daily_weather_data.avg_pressure_msl) AS avg_pressure_msl,
20+
sum(daily_weather_data.sum_sunshine_minutes) AS sum_sunshine_minutes,
21+
avg(daily_weather_data.avg_wind_direction_deg) AS avg_wind_direction_deg,
22+
avg(daily_weather_data.avg_wind_speed_kmh) AS avg_wind_speed_kmh,
23+
avg(daily_weather_data.avg_cloud_cover_percentage) AS avg_cloud_cover_percentage,
24+
avg(daily_weather_data.avg_dew_point_celcius) AS avg_dew_point_celcius,
25+
avg(
26+
daily_weather_data.avg_relative_humidity_percentage
27+
) AS avg_relative_humidity_percentage,
28+
avg(daily_weather_data.avg_visibility_m) AS avg_visibility_m,
29+
avg(daily_weather_data.avg_wind_gust_direction_deg) AS avg_wind_gust_direction_deg,
30+
avg(daily_weather_data.avg_wind_gust_speed_kmh) AS avg_wind_gust_speed_kmh
31+
FROM daily_weather_data
32+
GROUP BY to_char(daily_weather_data.measure_day, 'YYYY-MM')
33+
ORDER BY to_char(daily_weather_data.measure_day, 'YYYY-MM') DESC
34+
LIMIT limit_monts;
35+
END;
36+
$BODY$;
37+
ALTER FUNCTION public.accumulated_weather_per_month(integer) OWNER TO postgres;
38+
GRANT EXECUTE ON FUNCTION public.accumulated_weather_per_month(integer) TO PUBLIC;
39+
GRANT EXECUTE ON FUNCTION public.accumulated_weather_per_month(integer) TO anon;
40+
GRANT EXECUTE ON FUNCTION public.accumulated_weather_per_month(integer) TO authenticated;
41+
GRANT EXECUTE ON FUNCTION public.accumulated_weather_per_month(integer) TO postgres;
42+
GRANT EXECUTE ON FUNCTION public.accumulated_weather_per_month(integer) TO service_role;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CREATE POLICY "Authenticated users can select their own adoptions again - staging fix" ON public.trees_adopted AS PERMISSIVE FOR
2+
SELECT TO authenticated USING (((auth.uid())::text = uuid));
3+
DROP POLICY IF EXISTS "Everyon can select all adoptions" ON public.trees_adopted;

0 commit comments

Comments
 (0)