Fix PostgreSQL DDL: use single-quoted DEFAULT literals.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -309,7 +309,7 @@ def init_db():
|
|||||||
symbol TEXT, symbol_name TEXT, direction TEXT,
|
symbol TEXT, symbol_name TEXT, direction TEXT,
|
||||||
zone_upper REAL, zone_lower REAL,
|
zone_upper REAL, zone_lower REAL,
|
||||||
stop_loss REAL, take_profit REAL,
|
stop_loss REAL, take_profit REAL,
|
||||||
status TEXT DEFAULT "planned",
|
status TEXT DEFAULT 'planned',
|
||||||
triggered_at TIMESTAMP,
|
triggered_at TIMESTAMP,
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP)''')
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP)''')
|
||||||
c.execute('''CREATE TABLE IF NOT EXISTS key_monitors
|
c.execute('''CREATE TABLE IF NOT EXISTS key_monitors
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ def adapt_sql(sql: str) -> str:
|
|||||||
flags=re.IGNORECASE,
|
flags=re.IGNORECASE,
|
||||||
)
|
)
|
||||||
out = re.sub(r"\bAUTOINCREMENT\b", "", out, 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:
|
if "?" in out:
|
||||||
out = out.replace("?", "%s")
|
out = out.replace("?", "%s")
|
||||||
return out
|
return out
|
||||||
|
|||||||
Reference in New Issue
Block a user