Spaces:
Sleeping

microfunnel-api / backend /recreate_partners.py
MicroFunnel
Production-ready: Refactored codebase with Railway + Vercel config
cd61bf7
Raw History Blame Contribute Delete
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())