mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 06:46:00 +00:00
Merge branch 'master' into save-sync
This commit is contained in:
@@ -130,13 +130,19 @@ class DBCollectionsHandler(DBBaseHandler):
|
||||
)
|
||||
# Insert new CollectionRom entries for this collection
|
||||
if rom_ids:
|
||||
session.execute(
|
||||
insert(CollectionRom),
|
||||
[
|
||||
{"collection_id": id, "rom_id": rom_id}
|
||||
for rom_id in set(rom_ids)
|
||||
],
|
||||
# Filter out rom_ids that no longer exist in the roms table to
|
||||
# avoid foreign key constraint violations (e.g. after a rescan)
|
||||
valid_rom_ids = set(
|
||||
session.scalars(select(Rom.id).where(Rom.id.in_(rom_ids))).all()
|
||||
)
|
||||
if valid_rom_ids:
|
||||
session.execute(
|
||||
insert(CollectionRom),
|
||||
[
|
||||
{"collection_id": id, "rom_id": rom_id}
|
||||
for rom_id in valid_rom_ids
|
||||
],
|
||||
)
|
||||
|
||||
return session.scalar(query.filter_by(id=id).limit(1))
|
||||
|
||||
|
||||
@@ -641,7 +641,6 @@ class DBRomsHandler(DBBaseHandler):
|
||||
.with_only_columns(
|
||||
base_subquery.c.id,
|
||||
base_subquery.c.fs_name_no_ext,
|
||||
base_subquery.c.fs_name_no_tags,
|
||||
base_subquery.c.platform_id,
|
||||
base_subquery.c.igdb_id,
|
||||
base_subquery.c.ss_id,
|
||||
@@ -702,11 +701,6 @@ class DBRomsHandler(DBBaseHandler):
|
||||
base_subquery.c.flashpoint_id,
|
||||
base_subquery.c.platform_id,
|
||||
),
|
||||
_create_metadata_id_case(
|
||||
"fs",
|
||||
func.nullif(base_subquery.c.fs_name_no_tags, ""),
|
||||
base_subquery.c.platform_id,
|
||||
),
|
||||
_create_metadata_id_case(
|
||||
"romm",
|
||||
base_subquery.c.id,
|
||||
|
||||
Reference in New Issue
Block a user