Desynth page and improved item info api. Added string substitution to utils.

This commit is contained in:
Aodhan
2025-07-10 03:20:33 +01:00
parent b9b47c96f6
commit ef9b64adfe
38 changed files with 5703 additions and 4489 deletions

View File

@@ -51,10 +51,21 @@ async def ensure_view():
"""),
{"table": t},
)
stack_exists = await conn.scalar(
text(
"""
SELECT EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name=:table AND column_name='stack_size'
)
"""),
{"table": t},
)
desc_col = "description" if desc_exists else "NULL"
icon_col = "icon_id" if icon_exists else "NULL"
stack_col = "stack_size" if stack_exists else "NULL"
selects.append(
f"SELECT id, name, {desc_col} AS description, {icon_col} AS icon_id, type_description FROM {t}"
f"SELECT id, name, {desc_col} AS description, {icon_col} AS icon_id, type_description, {stack_col} AS stack_size FROM {t}"
)
union_sql = " UNION ALL ".join(selects)