fix: 软删除字段NULL兼容,用COALESCE避免已有用户无法登录
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 10s
Test / e2e-test (push) Successful in 50s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-11 22:05:24 +00:00
parent 5848a21540
commit f579a459a0
2 changed files with 9 additions and 8 deletions

View File

@@ -248,6 +248,7 @@ def init_db():
# Migration: soft-delete for users
if "deleted" not in user_cols:
c.execute("ALTER TABLE users ADD COLUMN deleted INTEGER DEFAULT 0")
c.execute("UPDATE users SET deleted = 0 WHERE deleted IS NULL")
if "deleted_at" not in user_cols:
c.execute("ALTER TABLE users ADD COLUMN deleted_at TEXT")