Spaces:
Sleeping
Sleeping
Download tests/ai/reset_database.py from Abdullahcoder54/Todo_App: direct link, hf CLI and curl.
- Browser
- Download file 713 Bytes
-
https://huggingface.co/spaces/Abdullahcoder54/Todo_App/resolve/main/tests/ai/reset_database.py
- Command line
-
hf download hf://spaces/Abdullahcoder54/Todo_App/tests/ai/reset_database.py
-
curl -L -o reset_database.py https://huggingface.co/spaces/Abdullahcoder54/Todo_App/resolve/main/tests/ai/reset_database.py
713 Bytes
| """ | |
| Simple script to recreate database tables | |
| """ | |
| import asyncio | |
| from sqlmodel import SQLModel | |
| from database.session import async_engine | |
| from models.user import User | |
| from models.task import Task | |
| async def reset_database(): | |
| print("Dropping and recreating database tables...") | |
| # Drop all tables first | |
| async with async_engine.begin() as conn: | |
| await conn.run_sync(SQLModel.metadata.drop_all) | |
| print("Tables dropped.") | |
| # Create all tables | |
| async with async_engine.begin() as conn: | |
| await conn.run_sync(SQLModel.metadata.create_all) | |
| print("Tables recreated successfully!") | |
| print("Database reset complete.") | |
| if __name__ == "__main__": | |
| asyncio.run(reset_database()) |