This commit is contained in:
itqop 2025-12-30 23:31:18 +03:00
parent 48e049fb04
commit a3615df165
1 changed files with 0 additions and 18 deletions

View File

@ -17,24 +17,6 @@ async def lifespan(app: FastAPI):
"""Application lifespan handler."""
# Startup
await init_db()
# TEMPORARY: Clean up old deleted assets (remove this after first run)
from app.infra.database import AsyncSessionLocal
from sqlalchemy import text
async with AsyncSessionLocal() as session:
# Check how many deleted assets exist
result = await session.execute(text("SELECT COUNT(*) FROM assets WHERE status = 'deleted'"))
count_before = result.scalar()
print(f"[MIGRATION] Found {count_before} assets with status='deleted'")
# Delete them
result = await session.execute(text("DELETE FROM assets WHERE status = 'deleted'"))
await session.commit()
print(f"[MIGRATION] Deleted {result.rowcount} assets with status='deleted'")
print("[MIGRATION] Migration complete - you can now remove this code from main.py")
# END TEMPORARY
yield
# Shutdown
pass