Skip to content

PRINTFILM: AI short-video marketing and AI short-drama creation platform

fix(db): ensure users.quota_left exists on schema bootstrap

yib114a19b2f75
diff --git a/backend/app/main.py b/backend/app/main.py
index df8e5ed..2e9b301 100644
--- a/backend/app/main.py
+++ b/backend/app/main.py
@@ -161,6 +161,9 @@ async def _apply_schema_patches() -> None:
# User billing columns
ucols = await _pg_columns(conn, "users")
+ # 早期库可能无 create_all 后缺此列(模型有、补丁曾遗漏)
+ if "quota_left" not in ucols:
+ await conn.execute(text("ALTER TABLE users ADD COLUMN quota_left INTEGER DEFAULT 5"))
if "balance_fen" not in ucols:
await conn.execute(text("ALTER TABLE users ADD COLUMN balance_fen INTEGER DEFAULT 0"))
if "frozen_fen" not in ucols: