Skip to content

Commit

Permalink
refactor(revert-solution): Revert previous temporary solution
Browse files Browse the repository at this point in the history
  • Loading branch information
GeloPakDev1 authored and GeloPakDev1 committed Feb 5, 2024
1 parent 9523a3b commit 05614a8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE OR REPLACE FUNCTION ${myuniversity}_${mymodule}.migrate_series_and_subjects(jsonb) RETURNS jsonb AS $$
DECLARE
instance jsonb := $1;
BEGIN
IF jsonb_typeof(instance->'series'->0) = 'string' THEN
instance = jsonb_set(instance, '{series}',
(SELECT COALESCE(jsonb_agg(v), '[]')
FROM (SELECT jsonb_build_object('value', jsonb_array_elements_text(instance->'series')) AS v) x));
END IF;
IF jsonb_typeof(instance->'subjects'->0) = 'string' THEN
instance = jsonb_set(instance, '{subjects}',
(SELECT COALESCE(jsonb_agg(v), '[]')
FROM (SELECT jsonb_build_object('value', jsonb_array_elements_text(instance->'subjects')) AS v) x));
END IF;
RETURN instance;
END;
$$ LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE;
5 changes: 5 additions & 0 deletions src/main/resources/templates/db_scripts/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,11 @@
"snippetPath": "setDefaultMetadataForHrIdSettings.sql",
"fromModuleVersion": "25.1.0"
},
{
"run": "after",
"snippetPath": "convertSeriesAndSubjects.sql",
"fromModuleVersion": "26.0.0"
},
{
"run": "after",
"snippetPath": "inventory-hierarchy/updateRecordsViewFunctionToSupportSource.sql",
Expand Down

0 comments on commit 05614a8

Please sign in to comment.