prod: UI Optimisée mise en production
- Documentation archivée et réorganisée - Backend: Ajout tests, migrations, library service, rate limiting - Frontend: Suppression Flutter, focus sur interface web HTML/JS - Tailwind CSS ajouté pour le style - Améliorations UX et corrections bugs Generated with [Claude Code](https://claude.com/claude-code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fix the completed column type bug in listening_history table."""
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Add backend to path
|
||||
sys.path.insert(0, str(Path(__file__).parent))
|
||||
|
||||
from app.core.database import get_db
|
||||
from sqlalchemy import text
|
||||
|
||||
async def fix_completed_column():
|
||||
"""Fix the completed column type from INTEGER to BOOLEAN."""
|
||||
print("🔧 Fixing completed column type...")
|
||||
|
||||
async for db in get_db():
|
||||
try:
|
||||
# Check current type
|
||||
result = await db.execute(text("""
|
||||
SELECT column_name, data_type
|
||||
FROM information_schema.columns
|
||||
WHERE table_name = 'listening_history'
|
||||
AND column_name = 'completed'
|
||||
"""))
|
||||
|
||||
for row in result:
|
||||
print(f" Current type: {row[1]}")
|
||||
|
||||
# Fix the column type
|
||||
await db.execute(text("""
|
||||
ALTER TABLE listening_history
|
||||
ALTER COLUMN completed
|
||||
TYPE BOOLEAN
|
||||
USING CASE WHEN completed = 1 THEN TRUE ELSE FALSE END
|
||||
"""))
|
||||
|
||||
await db.commit()
|
||||
print(" ✅ Column type fixed: INTEGER → BOOLEAN")
|
||||
|
||||
# Verify the fix
|
||||
result = await db.execute(text("""
|
||||
SELECT column_name, data_type
|
||||
FROM information_schema.columns
|
||||
WHERE table_name = 'listening_history'
|
||||
AND column_name = 'completed'
|
||||
"""))
|
||||
|
||||
for row in result:
|
||||
print(f" ✅ New type: {row[1]}")
|
||||
|
||||
except Exception as e:
|
||||
print(f" ❌ Error: {e}")
|
||||
await db.rollback()
|
||||
raise
|
||||
finally:
|
||||
await db.close()
|
||||
|
||||
print("🎉 Bug fixed successfully!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(fix_completed_column())
|
||||
Reference in New Issue
Block a user