Files
DataMate/scripts
Jerry Yan 48cf49d064 feat(db): update SQL init script and Alembic migration for compatibility
Update data-annotation-init.sql and Alembic migration to support both new and old deployments:

SQL Initialization Script (data-annotation-init.sql):
- Add file_version column to t_dm_annotation_results table
- Add Alembic version table creation and version insertion
- New deployments using this script will have latest schema and Alembic version marked

Alembic Migration (20250205_0001_add_file_version.py):
- Add column_exists() helper function to detect if column already exists
- Add compatibility check in upgrade(): skip if column exists (new SQL init)
- Add informative print messages for deployment clarity
- Enhanced docstrings explaining compatibility strategy

Deployment Scenarios:
1. New deployment with latest SQL script: Schema created with file_version, Alembic marked as applied
2. Old deployment upgrade: Alembic detects missing column and adds it

This ensures backward compatibility while supporting fresh installs with complete schema.
2026-02-05 21:17:17 +08:00
..