diff --git a/app.py b/app.py index 344a53d..0260084 100644 --- a/app.py +++ b/app.py @@ -325,6 +325,7 @@ def init_db(): trigger_price REAL, stop_loss REAL, take_profit REAL, result TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP)''') + conn.commit() migrations = [ "ALTER TABLE key_monitors ADD COLUMN symbol_name TEXT", "ALTER TABLE key_monitors ADD COLUMN upper_triggered INTEGER DEFAULT 0", @@ -376,6 +377,7 @@ def init_db(): 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, @@ -422,6 +424,7 @@ def init_db(): (key TEXT PRIMARY KEY, data_json TEXT NOT NULL, updated_at TEXT NOT NULL)''') + conn.commit() for sql in ( "ALTER TABLE fee_rates ADD COLUMN source TEXT DEFAULT 'local'", ): diff --git a/strategy/strategy_db.py b/strategy/strategy_db.py index d08d908..e29d822 100644 --- a/strategy/strategy_db.py +++ b/strategy/strategy_db.py @@ -149,6 +149,7 @@ def init_strategy_tables(conn) -> None: CTP_SIM_POSITIONS_SQL, ): conn.execute(sql) + conn.commit() try: conn.execute("ALTER TABLE trend_pullback_plans ADD COLUMN period TEXT DEFAULT '15m'") except Exception: