Fix PostgreSQL DDL: use single-quoted DEFAULT literals.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-01 08:12:34 +08:00
parent 52aca456e9
commit 1b276b5897
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -309,7 +309,7 @@ def init_db():
symbol TEXT, symbol_name TEXT, direction TEXT,
zone_upper REAL, zone_lower REAL,
stop_loss REAL, take_profit REAL,
status TEXT DEFAULT "planned",
status TEXT DEFAULT 'planned',
triggered_at TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP)''')
c.execute('''CREATE TABLE IF NOT EXISTS key_monitors
+1
View File
@@ -84,6 +84,7 @@ def adapt_sql(sql: str) -> str:
flags=re.IGNORECASE,
)
out = re.sub(r"\bAUTOINCREMENT\b", "", out, flags=re.IGNORECASE)
out = re.sub(r'DEFAULT\s+"([^"]*)"', r"DEFAULT '\1'", out, flags=re.IGNORECASE)
if "?" in out:
out = out.replace("?", "%s")
return out