Files
aitbc/apps/coordinator-api/src/app/database.py
AITBC Development 3a711d4e33 feat: add multi-chain support to blockchain explorer and update infrastructure configuration
- Add multi-chain support with ait-devnet, ait-testnet, ait-mainnet
- Add chain selector dropdown in explorer UI
- Add /api/chains endpoint to list supported chains
- Update all API endpoints to accept optional chain_id parameter
- Update RPC URL configuration to support multiple chains per network
- Change default port from 3001 to 8016 (enhanced services range)
- Update coordinator database path to ./
2026-03-10 08:25:27 +00:00

22 lines
572 B
Python
Executable File

"""Database configuration for the coordinator API."""
from sqlmodel import create_engine, SQLModel
from sqlalchemy import StaticPool
# Create in-memory SQLite database for now
engine = create_engine(
"sqlite:///./data/coordinator.db",
connect_args={"check_same_thread": False},
poolclass=StaticPool,
echo=True # Enable SQL logging for debugging
)
def create_db_and_tables():
"""Create database and tables"""
SQLModel.metadata.create_all(engine)
async def init_db():
"""Initialize database by creating tables"""
create_db_and_tables()