Spaces:
Paused

miracle / scratch /migrate_pg.py
dushyantsingh0
backend stabilization
3143c25
Raw History Blame Contribute Delete
570 Bytes
import asyncio
from sqlalchemy import text
from core.database import engine
async def migrate():
async with engine.begin() as conn:
try:
await conn.execute(text("ALTER TABLE \"user\" ADD COLUMN real_email VARCHAR"))
print("Successfully added real_email column to 'user' table.")
except Exception as e:
if "already exists" in str(e):
print("Column real_email already exists.")
else:
print(f"Migration error: {e}")
if __name__ == "__main__":
asyncio.run(migrate())