update file
set excluded_pages =
        (select '[' || STRING_AGG(excluded_pages || '', ', ') || ']' from file_entity_excluded_pages fe where fe.file_entity_id = file.id group by fe.file_entity_id);

update dossier
set members =
        (select '[' || STRING_AGG('"' || member_ids || '"', ', ') || ']'
         from dossier_entity_member_ids dem
         where dem.dossier_entity_id = dossier.id
         group by dem.dossier_entity_id);

update dossier
set approvers =
        (select '[' || STRING_AGG('"' || approver_ids || '"', ', ') || ']'
         from dossier_entity_approver_ids dem
         where dem.dossier_entity_id = dossier.id
         group by dem.dossier_entity_id);

update dossier
set download_file_types =
        (select '[' || STRING_AGG('"' || download_file_types || '"', ', ') || ']'
         from dossier_entity_download_file_types dem
         where dem.dossier_entity_id = dossier.id
         group by dem.dossier_entity_id);

update dossier_template
set download_file_types =
        (select '[' || STRING_AGG('"' || download_file_types || '"', ', ') || ']'
         from dossier_template_entity_download_file_types dem
         where dem.dossier_template_entity_id = dossier_template.id
         group by dem.dossier_template_entity_id);

update download_status
set download_file_types =
        (select '[' || STRING_AGG('"' || download_file_types || '"', ', ') || ']'
         from download_status_entity_download_file_types dem
         where dem.download_status_entity_storage_id = download_status.storage_id
         group by dem.download_status_entity_storage_id);
