Commit each schema migration separately on PostgreSQL.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-01 08:20:49 +08:00
parent 47ee9602d1
commit 8e1baf9a73
2 changed files with 4 additions and 1 deletions
+2 -1
View File
@@ -373,11 +373,11 @@ def init_db():
for sql in migrations:
try:
c.execute(sql)
conn.commit()
except Exception as exc:
if not is_schema_migration_error(exc):
raise
rollback_if_postgres(conn)
conn.commit()
c.execute('''CREATE TABLE IF NOT EXISTS review_records
(id INTEGER PRIMARY KEY AUTOINCREMENT,
open_time TEXT, close_time TEXT,
@@ -430,6 +430,7 @@ def init_db():
):
try:
c.execute(sql)
conn.commit()
except Exception as exc:
if not is_schema_migration_error(exc):
raise