Add startup scheme

This commit is contained in:
Rene Arumetsa
2026-07-26 21:36:26 +03:00
parent c40c871a4b
commit 94fe57a596
5 changed files with 42 additions and 1 deletions

15
bot.py
View File

@@ -383,6 +383,21 @@ async def on_ready():
log.info("Logged in as %s (ID: %s)", bot.user, bot.user.id)
economy.set_house(bot.user.id)
# PocketBase silently drops writes to fields missing from the collection
# schema, so surface any drift loudly instead of letting features no-op.
try:
missing = await economy.missing_schema_fields()
if missing:
log.error(
"PocketBase collection '%s' is missing %d schema field(s): %s "
"- writes to them are silently dropped! Run scripts/sync_pb_schema.py.",
config.PB_ECONOMY_COLLECTION, len(missing), ", ".join(missing),
)
else:
log.info("PocketBase schema check passed (%s)", config.PB_ECONOMY_COLLECTION)
except Exception as e:
log.warning("Could not verify PocketBase schema: %s", e)
_apply_profile_command_filters()
# Pull sheet data into cache