fix: Rename 'order' column to 'order_ticket' to avoid SQL reserved keyword

SQL 'order' is a reserved keyword causing OperationalError.
Renamed column to 'order_ticket' in both CREATE TABLE and INSERT statements.

Fixes: OperationalError: near "order": syntax error
This commit is contained in:
cbazza committed 2026-01-21 10:12:35 +01:00
1 parent 4f47b8e2fe
commit c30e3e1a82
1 file changed
+2 -2
+2 -2
View File
@@ -53,7 +53,7 @@ class MT5PnLTracker:
CREATE TABLE IF NOT EXISTS mt5_deals ( CREATE TABLE IF NOT EXISTS mt5_deals (
deal_id INTEGER PRIMARY KEY, deal_id INTEGER PRIMARY KEY,
ticket INTEGER, ticket INTEGER,
order INTEGER, order_ticket INTEGER,
time TEXT, time TEXT,
time_msc INTEGER, time_msc INTEGER,
type INTEGER, type INTEGER,
@@ -171,7 +171,7 @@ class MT5PnLTracker:
try: try:
cursor.execute(""" cursor.execute("""
INSERT OR IGNORE INTO mt5_deals ( INSERT OR IGNORE INTO mt5_deals (
deal_id, ticket, order, time, time_msc, type, entry, deal_id, ticket, order_ticket, time, time_msc, type, entry,
magic, position_id, reason, volume, price, commission, magic, position_id, reason, volume, price, commission,
swap, profit, fee, symbol, comment, external_id, imported_at swap, profit, fee, symbol, comment, external_id, imported_at
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)