Created
          July 5, 2017 05:40 
        
      - 
      
- 
        Save agilepoodle/baccc3260c3233d8cbfd11b2f0e576cb to your computer and use it in GitHub Desktop. 
Revisions
- 
        agilepoodle created this gist Jul 5, 2017 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ select id, jsonb_agg(selection_point - 'moduleId' - 'bottomSelectionPointParentId' || jsonb_build_object('moduleGroupId', (select group_id from module where id=selection_point->>'moduleId'))) into temporary education_vertical_top_selection_point_group_id from (select id, jsonb_array_elements(document -> 'structure' -> 'vertical' -> 'topSelectionPoints') as selection_point from education) tss group by id; update education set document = (jsonb_set(document, '{structure,vertical,topSelectionPoints}', '[{"localId": "sis-group-deg-0001", "moduleId": "sis-deg-non-existent-v1", "bottomNaming": "NAMES_NOTHING", "topDegreeTitleUrn": null, "bottomAcceptanceType": "AUTOMATIC", "bottomSelectionPoints": [], "bottomSelectionPointParentId": null}]') ) where id = 'test-education-in-future';