diff --git a/backend/alembic/versions/0034_virtual_collections_db_view.py b/backend/alembic/versions/0034_virtual_collections_db_view.py index b382fc677..f964ffc6a 100644 --- a/backend/alembic/versions/0034_virtual_collections_db_view.py +++ b/backend/alembic/versions/0034_virtual_collections_db_view.py @@ -115,9 +115,9 @@ def upgrade() -> None: 'Autogenerated ' || collection_type || ' collection' AS description, NOW() AS created_at, NOW() AS updated_at, - array_to_json(array_agg(rom_id)) as rom_ids, - array_to_json(array_agg(path_cover_s)) as path_covers_s, - array_to_json(array_agg(path_cover_l)) as path_covers_l + jsonb_agg(rom_id) as rom_ids, + jsonb_agg(path_cover_s) as path_covers_s, + jsonb_agg(path_cover_l) as path_covers_l FROM ( SELECT * FROM genres_collection UNION ALL @@ -149,7 +149,7 @@ def upgrade() -> None: connection.execute( sa.text( """ - CREATE OR REPLACE VIEW virtual_collections AS + CREATE OR REPLACE VIEW virtual_collections AS WITH genres AS ( SELECT r.id as rom_id, @@ -236,9 +236,9 @@ def upgrade() -> None: CONCAT('Autogenerated ', collection_name, ' collection') AS description, NOW() AS created_at, NOW() AS updated_at, - JSON_ARRAYAGG(DISTINCT rom_id) as rom_ids, - JSON_ARRAYAGG(DISTINCT path_cover_s) as path_covers_s, - JSON_ARRAYAGG(DISTINCT path_cover_l) as path_covers_l + JSON_ARRAYAGG(rom_id) as rom_ids, + JSON_ARRAYAGG(path_cover_s) as path_covers_s, + JSON_ARRAYAGG(path_cover_l) as path_covers_l FROM ( SELECT * FROM genres