-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MODFIN-358] - Add tenantId to the locations schema for restrict by F…
…und functionality (#406) [MODFIN-358] - Add tenantId to the locations schema for restrict by Fund functionality
- Loading branch information
1 parent
37a57c3
commit 33cf0d1
Showing
5 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 characters
Submodule acq-models
updated
5 files
This file contains 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 characters
8 changes: 8 additions & 0 deletions
8
src/main/resources/templates/db_scripts/migration/transform_location_ids_array.sql
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- Transform locationIds arrays to array of objects with locationId field inside them | ||
UPDATE ${myuniversity}_${mymodule}.fund | ||
SET jsonb = jsonb - 'locationIds' || jsonb_build_object( | ||
'locations', | ||
CASE WHEN jsonb->>'locationIds' = '[]' THEN '[]' ELSE | ||
(SELECT jsonb_agg(jsonb_build_object('locationId', value)) from jsonb_array_elements(jsonb->'locationIds')) END | ||
) | ||
WHERE jsonb ? 'locationIds'; |
This file contains 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 characters