diff --git a/backend/src/main/resources/db/migration/V1.7__update_error_schema.sql b/backend/src/main/resources/db/migration/V1.7__update_error_schema.sql new file mode 100644 index 000000000..503fab7a5 --- /dev/null +++ b/backend/src/main/resources/db/migration/V1.7__update_error_schema.sql @@ -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; \ No newline at end of file