From 04562352272c2154094a4f39a3ccc4086d49939a Mon Sep 17 00:00:00 2001 From: sisiphos3 Date: Sat, 28 Oct 2023 16:16:45 +0200 Subject: [PATCH] try again --- migrations/V36__add_user_to_kpi_definition.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/migrations/V36__add_user_to_kpi_definition.sql b/migrations/V36__add_user_to_kpi_definition.sql index 9f91504..66694d9 100644 --- a/migrations/V36__add_user_to_kpi_definition.sql +++ b/migrations/V36__add_user_to_kpi_definition.sql @@ -1,7 +1,8 @@ ALTER TABLE public.kpi_definition ALTER COLUMN created_by SET DEFAULT auth.uid (); -CREATE OR REPLACE VIEW +DROP VIEW if exists public.kpi_definition_with_latest_values +CREATE VIEW public.kpi_definition_with_latest_values as select ckd.circle_kpidef_id, @@ -69,7 +70,8 @@ order by kpi_id, ckd.circle_kpidef_id; -CREATE or REPLACE VIEW +DROP VIEW if exists public.kpi_values_period_standardized +CREATE VIEW public.kpi_values_period_standardized as select *, Case when target_value > 0 then ROUND(cumulative_value/target_value*100, 0) else null end as target_fulfilled