QuizFrog/backend/init_db.py

21 lines
485 B
Python

"""Create all database tables."""
import asyncio
import sys
import os
sys.path.insert(0, os.path.dirname(__file__))
from app.database import engine, Base
from app.models import User, Mistake, ReviewCard, ReviewLog, ReviewConfig, ExamPaper
async def main():
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.create_all)
print("Database tables created successfully!")
await engine.dispose()
if __name__ == "__main__":
asyncio.run(main())