Persist umami sql queries and stuff

This commit is contained in:
2025-11-18 15:24:07 +01:00
parent 444f7a376e
commit 87dd246d09
12 changed files with 262 additions and 0 deletions
@@ -0,0 +1,16 @@
-- Type returned by the crosstab function
CREATE TYPE weekly_sim_submit_count_crosstab AS (
group_name text,
transport bigint,
lice bigint,
virus bigint,
watercontact bigint,
sedimentation bigint
);
-- Cross tab function we can call on the materialized view of weekly submit counts
CREATE OR REPLACE FUNCTION crosstab_weekly_sim_submit_count(text)
RETURNS setof weekly_sim_submit_count_crosstab
AS '$libdir/tablefunc','crosstab' LANGUAGE C STABLE STRICT;