Skip to content

Commit

Permalink
db: Re-add in-between modifications to migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
jhf committed Nov 14, 2024
1 parent 1e4dda3 commit c3f87d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
6 changes: 3 additions & 3 deletions migrations/0019_create_view_time_context.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ CREATE VIEW public.time_context
, name_when_query
, name_when_input
, scope
, valid_on
, valid_from
, valid_to
, valid_on
, code -- Exposing the code for ordering
, path -- Exposing the path for ordering
) AS
Expand All @@ -23,9 +23,9 @@ WITH combined_data AS (
, name_when_query AS name_when_query
, name_when_input AS name_when_input
, scope AS scope
, valid_on AS valid_on
, valid_from AS valid_from
, valid_to AS valid_to
, valid_on AS valid_on
, code AS code -- Specific order column for relative_period
, NULL::public.LTREE AS path -- Null for path as not applicable here
FROM public.relative_period_with_time
Expand All @@ -51,4 +51,4 @@ WITH combined_data AS (
)
SELECT *
FROM combined_data
ORDER BY type, code, path;
ORDER BY type, code, path;
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@ CREATE OR REPLACE FUNCTION public.stat_for_unit_hierarchy(
WITH ordered_data AS (
SELECT
to_jsonb(sfu.*)
- 'value_int' - 'value_float' - 'value_string' - 'value_bool'
|| jsonb_build_object('stat_definition', to_jsonb(sd.*))
|| CASE sd.type
WHEN 'int' THEN jsonb_build_object(sd.code, sfu.value_int)
WHEN 'float' THEN jsonb_build_object(sd.code, sfu.value_float)
WHEN 'string' THEN jsonb_build_object(sd.code, sfu.value_string)
WHEN 'bool' THEN jsonb_build_object(sd.code, sfu.value_bool)
END
|| (SELECT public.data_source_hierarchy(sfu.data_source_id))
AS data
FROM public.stat_for_unit AS sfu
Expand All @@ -32,4 +25,4 @@ SELECT CASE
ELSE jsonb_build_object('stat_for_unit',data)
END
FROM data_list;
$$;
$$;

0 comments on commit c3f87d7

Please sign in to comment.