Show downloads even without releases rows

Add synthetic release groups in getEntryById so downloads
are displayed even when there are no matching rows in
`releases` for a given entry. Group by `release_seq`,
attach downloads, and sort groups for stable order.

This fixes cases like /zxdb/entries/1 where `downloads`
exist for the entry but `releases` is empty, resulting in
no downloads shown in the UI.

Signed-off-by: Junie@devbox
This commit is contained in:
2025-12-16 21:47:17 +00:00
parent 285c7da87c
commit fd4c0f8963
3 changed files with 147 additions and 104 deletions

View File

@@ -1,14 +1,12 @@
Handle missing ZXDB releases/downloads schema gracefully
Show downloads even without releases rows
Prevent runtime crashes when `releases`, `downloads`, or related lookup tables
(`releasetypes`, `schemetypes`, `sourcetypes`, `casetypes`) are absent in the
connected ZXDB MySQL database.
Add synthetic release groups in getEntryById so downloads
are displayed even when there are no matching rows in
`releases` for a given entry. Group by `release_seq`,
attach downloads, and sort groups for stable order.
- Repo: gate releases/downloads queries behind a schema capability check using
`information_schema.tables`; if missing, skip queries and return empty arrays.
- Keeps entry detail page functional on legacy/minimal DB exports while fully
utilizing rich data when available.
This fixes cases like /zxdb/entries/1 where `downloads`
exist for the entry but `releases` is empty, resulting in
no downloads shown in the UI.
Refs: runtime error "Table 'zxdb.releasetypes' doesn't exist"
Signed-off-by: Junie@quinn
Signed-off-by: Junie@devbox