Skip to content

Commit d10fe0d

Browse files
hf-kkleinKonstantin
andauthored
fmt: format all .sql with jetbrains builtin sql formatter (#136)
to reduce diff noise later on sorry. we don't enforce this in the ci yet Co-authored-by: Konstantin <[email protected]>
1 parent 9a45e07 commit d10fe0d

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

src/fundamend/sqlmodels/create_ahbtabellen_view.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ WITH consolidated_ahm AS (SELECT id,
2323
coalesce(segment_ahb_status, segmentgroup_ahb_status)))) AS line_ahb_status,
2424
coalesce(code_name, coalesce(dataelement_name, coalesce(dataelementgroup_name,
2525
coalesce(segment_name, segmentgroup_name)))) AS line_name,
26-
type as line_type
26+
type as line_type
2727
FROM ahb_hierarchy_materialized ahm
2828
WHERE ahm.TYPE != 'dataelementgroup'
2929
AND (ahm.TYPE != 'dataelement' OR ahm.dataelement_ahb_status IS NOT NULL))

src/fundamend/sqlmodels/materialize_ahb_view.sql

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@ WITH RECURSIVE
6161
) AS root_order
6262
FROM ordered_roots),
6363

64-
root_hierarchy AS (SELECT o.anwendungsfall_primary_key AS anwendungsfall_pk,
65-
o.primary_key AS current_id,
66-
o.primary_key AS root_id,
67-
NULL AS parent_id,
68-
0 AS depth,
64+
root_hierarchy AS (SELECT o.anwendungsfall_primary_key AS anwendungsfall_pk,
65+
o.primary_key AS current_id,
66+
o.primary_key AS root_id,
67+
NULL AS parent_id,
68+
0 AS depth,
6969
o.position,
70-
o.name AS path,
71-
o.name AS parent_path,
70+
o.name AS path,
71+
o.name AS parent_path,
7272
o.root_order,
7373
o.type,
74-
o.primary_key AS source_id,
75-
substr('00000' || o.position, -5) || '-' AS sort_path,
76-
o.root_id_text || '>' AS id_path,
74+
o.primary_key AS source_id,
75+
substr('00000' || o.position, -5) || '-' AS sort_path,
76+
o.root_id_text || '>' AS id_path,
7777
o.pruefidentifikator,
7878
o.format,
7979
o.versionsnummer,
@@ -84,35 +84,35 @@ WITH RECURSIVE
8484
o.edifact_format_version,
8585
o.anwendungshandbuch_primary_key,
8686

87-
CASE WHEN o.type = 'segment_group' THEN o.root_id_text ELSE NULL END AS segmentgroup_id,
88-
CASE WHEN o.type = 'segment_group' THEN o.name ELSE NULL END AS segmentgroup_name,
89-
CASE WHEN o.type = 'segment_group' THEN o.ahb_status ELSE NULL END AS segmentgroup_ahb_status,
90-
CASE WHEN o.type = 'segment_group' THEN o.position ELSE NULL END AS segmentgroup_position,
87+
CASE WHEN o.type = 'segment_group' THEN o.root_id_text ELSE NULL END AS segmentgroup_id,
88+
CASE WHEN o.type = 'segment_group' THEN o.name ELSE NULL END AS segmentgroup_name,
89+
CASE WHEN o.type = 'segment_group' THEN o.ahb_status ELSE NULL END AS segmentgroup_ahb_status,
90+
CASE WHEN o.type = 'segment_group' THEN o.position ELSE NULL END AS segmentgroup_position,
9191
CASE
9292
WHEN o.type = 'segment_group' THEN o.anwendungsfall_primary_key
93-
ELSE NULL END AS segmentgroup_anwendungsfall_primary_key,
94-
95-
CASE WHEN o.type = 'segment' THEN o.root_id_text ELSE NULL END AS segment_id,
96-
CASE WHEN o.type = 'segment' THEN o.name ELSE NULL END AS segment_name,
97-
CASE WHEN o.type = 'segment' THEN o.number ELSE NULL END AS segment_number,
98-
CASE WHEN o.type = 'segment' THEN o.ahb_status ELSE NULL END AS segment_ahb_status,
99-
CASE WHEN o.type = 'segment' THEN o.position ELSE NULL END AS segment_position,
100-
101-
NULL AS dataelementgroup_id,
102-
NULL AS dataelementgroup_name,
103-
NULL AS dataelementgroup_position,
104-
105-
NULL AS dataelement_id,
106-
NULL AS dataelement_name,
107-
NULL AS dataelement_position,
108-
NULL AS dataelement_ahb_status,
109-
110-
NULL AS code_id,
111-
NULL AS code_name,
112-
NULL AS code_description,
113-
NULL AS code_value,
114-
NULL AS code_ahb_status,
115-
NULL AS code_position
93+
ELSE NULL END AS segmentgroup_anwendungsfall_primary_key,
94+
95+
CASE WHEN o.type = 'segment' THEN o.root_id_text ELSE NULL END AS segment_id,
96+
CASE WHEN o.type = 'segment' THEN o.name ELSE NULL END AS segment_name,
97+
CASE WHEN o.type = 'segment' THEN o.number ELSE NULL END AS segment_number,
98+
CASE WHEN o.type = 'segment' THEN o.ahb_status ELSE NULL END AS segment_ahb_status,
99+
CASE WHEN o.type = 'segment' THEN o.position ELSE NULL END AS segment_position,
100+
101+
NULL AS dataelementgroup_id,
102+
NULL AS dataelementgroup_name,
103+
NULL AS dataelementgroup_position,
104+
105+
NULL AS dataelement_id,
106+
NULL AS dataelement_name,
107+
NULL AS dataelement_position,
108+
NULL AS dataelement_ahb_status,
109+
110+
NULL AS code_id,
111+
NULL AS code_name,
112+
NULL AS code_description,
113+
NULL AS code_value,
114+
NULL AS code_ahb_status,
115+
NULL AS code_position
116116
FROM ordered_roots_with_order o),
117117

118118
hierarchy AS (SELECT *

0 commit comments

Comments
 (0)