From 16ed1a4fca28d1baac137ce5c8ae4b724c802b1b Mon Sep 17 00:00:00 2001 From: Jan Bernitt Date: Thu, 30 Nov 2023 16:00:03 +0100 Subject: [PATCH] fix: revert table renames --- dhis-2/dhis-services/dhis-service-administration/pom.xml | 4 ---- .../categories/categories_no_options.yaml | 6 +++--- .../categories/categories_one_default_category.yaml | 4 ++-- .../categories_one_default_category_option.yaml | 4 ++-- .../categories/categories_same_category_options.yaml | 4 ++-- .../categories_shared_category_options_in_combo.yaml | 4 ++-- .../categories/category_option_groups_excess_members.yaml | 4 ++-- .../category_option_groups_sets_incomplete.yaml | 8 ++++---- .../categories/category_options_no_categories.yaml | 4 ++-- 9 files changed, 19 insertions(+), 23 deletions(-) diff --git a/dhis-2/dhis-services/dhis-service-administration/pom.xml b/dhis-2/dhis-services/dhis-service-administration/pom.xml index fc550b3e3465..4ed705f7b315 100644 --- a/dhis-2/dhis-services/dhis-service-administration/pom.xml +++ b/dhis-2/dhis-services/dhis-service-administration/pom.xml @@ -99,10 +99,6 @@ org.springframework spring-web - - javax.persistence - javax.persistence-api - org.hibernate hibernate-core diff --git a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_no_options.yaml b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_no_options.yaml index f3ea6e66da76..2a5960ad6148 100644 --- a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_no_options.yaml +++ b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_no_options.yaml @@ -31,11 +31,11 @@ section: Categories summary_sql: >- select COUNT(*) as value, - 100 * COUNT(*) / NULLIF( (SELECT COUNT(*) FROM category), 0) as percent - from category where categoryid + 100 * COUNT(*) / NULLIF( (SELECT COUNT(*) FROM dataelementcategory), 0) as percent + from dataelementcategory where categoryid not in (select distinct categoryid from categories_categoryoptions); details_sql: >- - SELECT uid,name from category + SELECT uid,name from dataelementcategory where categoryid not in (select distinct categoryid from categories_categoryoptions) ORDER BY name; diff --git a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_one_default_category.yaml b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_one_default_category.yaml index ef102c86dd4e..a8ea841e03c3 100644 --- a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_one_default_category.yaml +++ b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_one_default_category.yaml @@ -29,10 +29,10 @@ name: categories_one_default_category description: Only one "default" category should exist section: Categories summary_sql: >- - SELECT count(*) AS count FROM category + SELECT count(*) AS count FROM dataelementcategory WHERE name = 'default' AND uid != 'GLevLNI9wkl'; details_sql: >- - SELECT uid, name FROM category + SELECT uid, name FROM dataelementcategory WHERE name = 'default' AND uid != 'GLevLNI9wkl' ORDER BY categoryid; details_id_type: categories diff --git a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_one_default_category_option.yaml b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_one_default_category_option.yaml index d2cb23209543..72465253f354 100644 --- a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_one_default_category_option.yaml +++ b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_one_default_category_option.yaml @@ -29,10 +29,10 @@ name: categories_one_default_category_option description: Only one "default" category option should exist section: Categories summary_sql: >- - SELECT count(*) AS count FROM categoryoption + SELECT count(*) AS count FROM dataelementcategoryoption WHERE name = 'default' AND uid != 'xYerKDKCefk'; details_sql: >- - SELECT uid, name FROM categoryoption + SELECT uid, name FROM dataelementcategoryoption WHERE name = 'default' AND uid != 'xYerKDKCefk' ORDER BY categoryoptionid; details_id_type: categoryOptions diff --git a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_same_category_options.yaml b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_same_category_options.yaml index d922a2acf9b5..09bcc3ab03ac 100644 --- a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_same_category_options.yaml +++ b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_same_category_options.yaml @@ -39,10 +39,10 @@ ) SELECT COUNT(*) as value, 100.0 * COUNT(*) / NULLIF( (SELECT COUNT(*) - FROM category),0 ) percent + FROM dataelementcategory),0 ) percent FROM duplicative_categories; details_sql: >- - SELECT x.uid,'(' || b.rank || ') ' || x.name as name from category x + SELECT x.uid,'(' || b.rank || ') ' || x.name as name from dataelementcategory x INNER JOIN ( SELECT categoryid, array_agg(categoryoptionid ORDER BY categoryoptionid) as catoptions from categories_categoryoptions GROUP BY categoryid diff --git a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_shared_category_options_in_combo.yaml b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_shared_category_options_in_combo.yaml index 82a97bb0285b..229002d24706 100644 --- a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_shared_category_options_in_combo.yaml +++ b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/categories_shared_category_options_in_combo.yaml @@ -34,7 +34,7 @@ summary_sql: >- select cc.name as cc_name, co.categoryoptionid, co.name as co_name from categorycombo cc inner join categorycombos_categories ccc on cc.categorycomboid=ccc.categorycomboid inner join categories_categoryoptions cco on ccc.categoryid=cco.categoryid - inner join categoryoption co on cco.categoryoptionid=co.categoryoptionid + inner join dataelementcategoryoption co on cco.categoryoptionid=co.categoryoptionid group by cc_name, co.categoryoptionid, co_name having count(*) > 1 ) SELECT COUNT(*)as value, @@ -45,7 +45,7 @@ details_sql: >- select cc.uid, cc.name as cc_name, co.categoryoptionid, co.name as co_name from categorycombo cc inner join categorycombos_categories ccc on cc.categorycomboid=ccc.categorycomboid inner join categories_categoryoptions cco on ccc.categoryid=cco.categoryid - inner join categoryoption co on cco.categoryoptionid=co.categoryoptionid + inner join dataelementcategoryoption co on cco.categoryoptionid=co.categoryoptionid group by cc.uid, cc_name, co.categoryoptionid, co_name having count(*) > 1 ) SELECT uid, cc_name as name, diff --git a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_option_groups_excess_members.yaml b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_option_groups_excess_members.yaml index 67c7d28fbff9..eb4c4f79a4f3 100644 --- a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_option_groups_excess_members.yaml +++ b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_option_groups_excess_members.yaml @@ -48,7 +48,7 @@ summary_sql: >- INNER JOIN categoryoptiongroupsetmembers b on a.categoryoptiongroupid = b.categoryoptiongroupid ) c GROUP BY c.categoryoptionid,c.categoryoptiongroupsetid HAVING array_length(array_agg(c.categoryoptionid), 1) > 1 ) d ) e - INNER JOIN categoryoption co on e.categoryoptionid = co.categoryoptionid + INNER JOIN dataelementcategoryoption co on e.categoryoptionid = co.categoryoptionid INNER JOIN categoryoptiongroupset cogs on e.categoryoptiongroupsetid = cogs.categoryoptiongroupsetid INNER JOIN categoryoptiongroup cog on e.categoryoptiongroupid = cog.categoryoptiongroupid ) x GROUP BY x.uid,x.name,x.cogs_name @@ -74,7 +74,7 @@ details_sql: >- INNER JOIN categoryoptiongroupsetmembers b on a.categoryoptiongroupid = b.categoryoptiongroupid ) c GROUP BY c.categoryoptionid,c.categoryoptiongroupsetid HAVING array_length(array_agg(c.categoryoptionid), 1) > 1 ) d ) e - INNER JOIN categoryoption co on e.categoryoptionid = co.categoryoptionid + INNER JOIN dataelementcategoryoption co on e.categoryoptionid = co.categoryoptionid INNER JOIN categoryoptiongroupset cogs on e.categoryoptiongroupsetid = cogs.categoryoptiongroupsetid INNER JOIN categoryoptiongroup cog on e.categoryoptiongroupid = cog.categoryoptiongroupid ) x GROUP BY x.uid,x.name,x.cogs_name diff --git a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_option_groups_sets_incomplete.yaml b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_option_groups_sets_incomplete.yaml index 3707569f30ee..abc7b2eeb11c 100644 --- a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_option_groups_sets_incomplete.yaml +++ b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_option_groups_sets_incomplete.yaml @@ -53,8 +53,8 @@ summary_sql: >- (SELECT categoryid,array_agg(categoryoptionid) as wants from categories_categoryoptions GROUP BY categoryid) as z USING (categoryid) ) as cat_option_group_check ) f) g INNER JOIN categoryoptiongroupset cogs USING(categoryoptiongroupsetid) - INNER JOIN category cats USING(categoryid) - INNER JOIN categoryoption opt USING(categoryoptionid) + INNER JOIN dataelementcategory cats USING(categoryid) + INNER JOIN dataelementcategoryoption opt USING(categoryoptionid) ORDER BY cogs.uid, cats.name) SELECT COUNT(*) as value, 100 * COUNT(*) / NULLIF( (SELECT COUNT(*) from categoryoptiongroupmembers @@ -83,8 +83,8 @@ details_sql: >- (SELECT categoryid,array_agg(categoryoptionid) as wants from categories_categoryoptions GROUP BY categoryid) as z USING (categoryid) ) as cat_option_group_check ) f) g INNER JOIN categoryoptiongroupset cogs USING(categoryoptiongroupsetid) - INNER JOIN category cats USING(categoryid) - INNER JOIN categoryoption opt USING(categoryoptionid) + INNER JOIN dataelementcategory cats USING(categoryid) + INNER JOIN dataelementcategoryoption opt USING(categoryoptionid) ORDER BY cogs.uid, cats.name; details_id_type: categoryOptionGroupSets severity: SEVERE diff --git a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_options_no_categories.yaml b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_options_no_categories.yaml index ca31c72bc66f..e2f0c65e2acd 100644 --- a/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_options_no_categories.yaml +++ b/dhis-2/dhis-services/dhis-service-administration/src/main/resources/data-integrity-checks/categories/category_options_no_categories.yaml @@ -31,7 +31,7 @@ section_order: 3 summary_sql: >- WITH category_options_no_categories AS ( - SELECT uid,name FROM categoryoption + SELECT uid,name FROM dataelementcategoryoption WHERE categoryoptionid NOT IN (SELECT DISTINCT categoryoptionid @@ -41,7 +41,7 @@ FROM categoryoption), 0 ) as percent FROM category_options_no_categories; details_sql: >- - SELECT uid,name FROM categoryoption + SELECT uid,name FROM dataelementcategoryoption WHERE categoryoptionid NOT IN (SELECT DISTINCT categoryoptionid