Spaces:
Sleeping
Sleeping
Download backend/recreate_partners.py from axeronis/microfunnel-api: direct link, hf CLI and curl.
- Browser
- Download file 703 Bytes
-
https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/recreate_partners.py
- Command line
-
hf download hf://spaces/axeronis/microfunnel-api/backend/recreate_partners.py
-
curl -L -o recreate_partners.py https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/recreate_partners.py
703 Bytes
| """Recreate partners table with updated schema.""" | |
| import asyncio | |
| from sqlalchemy import text | |
| from sqlmodel import SQLModel | |
| from app.core.database import async_engine | |
| from app.models import Partner | |
| async def recreate_partners(): | |
| """Drop and recreate partners table.""" | |
| async with async_engine.begin() as conn: | |
| # Drop old table | |
| await conn.execute(text("DROP TABLE IF EXISTS partners CASCADE")) | |
| print("✅ Dropped partners table") | |
| # Create new table with updated schema | |
| await conn.run_sync(SQLModel.metadata.create_all) | |
| print("✅ Created partners table with new schema") | |
| if __name__ == "__main__": | |
| asyncio.run(recreate_partners()) | |