mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 11:06:40 +07:00
fix: seed app_settings.currency от AURUM_DEFAULT_CURRENCY на чистой установке
This commit is contained in:
@@ -79,9 +79,15 @@ async def seed_default_account(session: AsyncSession) -> None:
|
||||
|
||||
|
||||
async def seed_default_app_settings(session: AsyncSession) -> None:
|
||||
"""Ensures the singleton app_settings row (id=1) exists — the migration
|
||||
already inserts it, but this makes app boot self-healing if that row is
|
||||
ever missing (e.g. a DB restored from a pre-currency-setting backup)."""
|
||||
"""Ensures the singleton app_settings row (id=1) exists, seeded with
|
||||
AURUM_DEFAULT_CURRENCY. The sole place that row gets created — the
|
||||
9f3a2d7c5e11 migration only creates the table now, not the row itself
|
||||
(an earlier version hardcoded the row to 'USD' at migration time, which
|
||||
silently ignored AURUM_DEFAULT_CURRENCY on a fresh install since this
|
||||
function's own get-or-create check would find the row already there).
|
||||
Runs on every app boot (see main.py's lifespan), so it's also
|
||||
self-healing if the row is ever missing (e.g. a DB restored from a
|
||||
pre-currency-setting backup)."""
|
||||
existing = await session.get(AppSettings, 1)
|
||||
if existing is not None:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user