Ragora-Server / init_db.py
Peterase's picture
feat: add Neon and Qdrant Cloud support
405d962
raw
history blame contribute delete
880 Bytes
"""Initialize database tables."""
import sys
import os
# Add app to path
sys.path.insert(0, os.path.dirname(__file__))
from app.database import engine
from app.models import Base
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def init_database():
"""Create all database tables."""
try:
logger.info("Creating database tables...")
Base.metadata.create_all(bind=engine)
logger.info("✅ Database tables created successfully!")
# List created tables
from sqlalchemy import inspect
inspector = inspect(engine)
tables = inspector.get_table_names()
logger.info(f"Created tables: {', '.join(tables)}")
except Exception as e:
logger.error(f"❌ Failed to create tables: {e}")
raise
if __name__ == "__main__":
init_database()