Skip to content

Commit 9cae52a

Browse files
jirhikerCopilot
andauthored
Update alembic/versions/d5e6f7a8b9c0_create_pygeoapi_supporting_views.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 92e031c commit 9cae52a

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

alembic/versions/d5e6f7a8b9c0_create_pygeoapi_supporting_views.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,19 @@ def _create_refresh_function() -> str:
208208
RETURNS void
209209
LANGUAGE plpgsql
210210
AS $$
211+
DECLARE
212+
matview_record record;
213+
matview_fqname text;
211214
BEGIN
212-
REFRESH MATERIALIZED VIEW public.ogc_latest_depth_to_water_wells;
213-
REFRESH MATERIALIZED VIEW public.ogc_avg_tds_wells;
215+
FOR matview_record IN
216+
SELECT schemaname, matviewname
217+
FROM pg_matviews
218+
WHERE schemaname = 'public'
219+
AND matviewname LIKE 'ogc_%'
220+
LOOP
221+
matview_fqname := format('%I.%I', matview_record.schemaname, matview_record.matviewname);
222+
EXECUTE format('REFRESH MATERIALIZED VIEW %s', matview_fqname);
223+
END LOOP;
214224
END;
215225
$$;
216226
"""

0 commit comments

Comments
 (0)