-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9398476
commit e6ef403
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
backend/src/main/resources/db/migration/V1.7__update_error_schema.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,55 @@ | ||
update sequence_entries_preprocessed_data | ||
set warnings = ( | ||
select json_agg( | ||
json_build_object( | ||
'unprocessedFields', ( | ||
select json_agg( | ||
json_build_object( | ||
'name', source->>'name', | ||
'type', source->>'type' | ||
) | ||
) | ||
from json_array_elements(warning->'source') as source | ||
), | ||
'processedFields', ( | ||
select json_agg( | ||
json_build_object( | ||
'name', source->>'name', | ||
'type', source->>'type' | ||
) | ||
) | ||
from json_array_elements(warning->'source') as source | ||
), | ||
'message', warning->>'message' | ||
) | ||
) | ||
from json_array_elements(warnings) as warning | ||
) | ||
where warnings is not null; | ||
set errors = ( | ||
select json_agg( | ||
json_build_object( | ||
'unprocessedFields', ( | ||
select json_agg( | ||
json_build_object( | ||
'name', source->>'name', | ||
'type', source->>'type' | ||
) | ||
) | ||
from json_array_elements(error->'source') as source | ||
), | ||
'processedFields', ( | ||
select json_agg( | ||
json_build_object( | ||
'name', source->>'name', | ||
'type', source->>'type' | ||
) | ||
) | ||
from json_array_elements(error->'source') as source | ||
), | ||
'message', error->>'message' | ||
) | ||
) | ||
from json_array_elements(errors) as error | ||
) | ||
where errors is not null; |