parent
70a77ba3d9
commit
76a3e97e05
@ -307,7 +307,9 @@ def check_migrate(engine, decl_base, previous_tables) -> None:
|
|||||||
# Migrates both trades and orders table!
|
# Migrates both trades and orders table!
|
||||||
# if ('orders' not in previous_tables
|
# if ('orders' not in previous_tables
|
||||||
# or not has_column(cols_orders, 'stop_price')):
|
# or not has_column(cols_orders, 'stop_price')):
|
||||||
|
migrating = False
|
||||||
if not has_column(cols_trades, 'precision_mode'):
|
if not has_column(cols_trades, 'precision_mode'):
|
||||||
|
migrating = True
|
||||||
logger.info(f"Running database migration for trades - "
|
logger.info(f"Running database migration for trades - "
|
||||||
f"backup: {table_back_name}, {order_table_bak_name}")
|
f"backup: {table_back_name}, {order_table_bak_name}")
|
||||||
migrate_trades_and_orders_table(
|
migrate_trades_and_orders_table(
|
||||||
@ -315,6 +317,7 @@ def check_migrate(engine, decl_base, previous_tables) -> None:
|
|||||||
order_table_bak_name, cols_orders)
|
order_table_bak_name, cols_orders)
|
||||||
|
|
||||||
if not has_column(cols_pairlocks, 'side'):
|
if not has_column(cols_pairlocks, 'side'):
|
||||||
|
migrating = True
|
||||||
logger.info(f"Running database migration for pairlocks - "
|
logger.info(f"Running database migration for pairlocks - "
|
||||||
f"backup: {pairlock_table_bak_name}")
|
f"backup: {pairlock_table_bak_name}")
|
||||||
|
|
||||||
@ -329,3 +332,6 @@ def check_migrate(engine, decl_base, previous_tables) -> None:
|
|||||||
|
|
||||||
set_sqlite_to_wal(engine)
|
set_sqlite_to_wal(engine)
|
||||||
fix_old_dry_orders(engine)
|
fix_old_dry_orders(engine)
|
||||||
|
|
||||||
|
if migrating:
|
||||||
|
logger.info("Database migration finished.")
|
||||||
|
@ -1387,6 +1387,7 @@ def test_migrate_new(mocker, default_conf, fee, caplog):
|
|||||||
assert log_has("trying trades_bak2", caplog)
|
assert log_has("trying trades_bak2", caplog)
|
||||||
assert log_has("Running database migration for trades - backup: trades_bak2, orders_bak0",
|
assert log_has("Running database migration for trades - backup: trades_bak2, orders_bak0",
|
||||||
caplog)
|
caplog)
|
||||||
|
assert log_has("Database migration finished.", caplog)
|
||||||
assert pytest.approx(trade.open_trade_value) == trade._calc_open_trade_value(
|
assert pytest.approx(trade.open_trade_value) == trade._calc_open_trade_value(
|
||||||
trade.amount, trade.open_rate)
|
trade.amount, trade.open_rate)
|
||||||
assert trade.close_profit_abs is None
|
assert trade.close_profit_abs is None
|
||||||
|
Loading…
Reference in New Issue
Block a user