Files
OCR/backend/fix_alembic_version.py
egg fd98018ddd refactor: complete V1 to V2 migration and remove legacy architecture
Remove all V1 architecture components and promote V2 to primary:
- Delete all paddle_ocr_* table models (export, ocr, translation, user)
- Delete legacy routers (auth, export, ocr, translation)
- Delete legacy schemas and services
- Promote user_v2.py to user.py as primary user model
- Update all imports and dependencies to use V2 models only
- Update main.py version to 2.0.0

Database changes:
- Fix SQLAlchemy reserved word: rename audit_log.metadata to extra_data
- Add migration to drop all paddle_ocr_* tables
- Update alembic env to only import V2 models

Frontend fixes:
- Fix Select component exports in TaskHistoryPage.tsx
- Update to use simplified Select API with options prop
- Fix AxiosInstance TypeScript import syntax

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-14 21:27:39 +08:00

30 lines
984 B
Python

#!/usr/bin/env python3
"""Fix alembic version in database"""
from sqlalchemy import create_engine, text
from app.core.config import settings
# Create database connection
engine = create_engine(settings.database_url)
with engine.connect() as conn:
# Delete the problematic version
conn.execute(text("DELETE FROM alembic_version WHERE version_num = '3ede847231ff'"))
conn.commit()
print("✓ Removed problematic alembic version")
# Check current version
result = conn.execute(text("SELECT version_num FROM alembic_version"))
versions = result.fetchall()
if versions:
print(f"Current version(s): {[v[0] for v in versions]}")
else:
print("No alembic version found in database")
# Set to the base version before our new migrations
conn.execute(text("INSERT INTO alembic_version (version_num) VALUES ('271dc036ea80')"))
conn.commit()
print("✓ Set alembic version to 271dc036ea80")
print("\nDone!")