30 lines
718 B
Python
30 lines
718 B
Python
import sys
|
|
import os
|
|
|
|
# Ensure current dir is in path
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
from database import init_db, SessionLocal, AccountBalance, Holding, engine
|
|
from trader import trader
|
|
import logging
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
def test_db_migration():
|
|
print("Initializing DB...")
|
|
init_db()
|
|
|
|
# Check tables
|
|
from sqlalchemy import inspect
|
|
inspector = inspect(engine)
|
|
tables = inspector.get_table_names()
|
|
print(f"Tables: {tables}")
|
|
|
|
if "account_balance" in tables and "holdings" in tables:
|
|
print("PASS: New tables created.")
|
|
else:
|
|
print("FAIL: Tables missing.")
|
|
|
|
if __name__ == "__main__":
|
|
test_db_migration()
|