Files
OCR/backend/check_tables.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

33 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""Check existing tables"""
from sqlalchemy import create_engine, text
from app.core.config import settings
engine = create_engine(settings.database_url)
with engine.connect() as conn:
# Get all tables
result = conn.execute(text("SHOW TABLES"))
tables = [row[0] for row in result.fetchall()]
print("Existing tables:")
for table in sorted(tables):
print(f" - {table}")
# Check which V2 tables exist
v2_tables = ['tool_ocr_users', 'tool_ocr_sessions', 'tool_ocr_tasks',
'tool_ocr_task_files', 'tool_ocr_audit_logs']
print("\nV2 Tables status:")
for table in v2_tables:
exists = table in tables
print(f" {'' if exists else ''} {table}")
# Check which old tables exist
old_tables = ['paddle_ocr_users', 'paddle_ocr_batches', 'paddle_ocr_files',
'paddle_ocr_results', 'paddle_ocr_export_rules', 'paddle_ocr_translation_configs']
print("\nOld Tables status:")
for table in old_tables:
exists = table in tables
print(f" {'' if exists else ''} {table}")