mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-14 00:22:16 +00:00
feat: add automatic balance timestamp migration mechanism
- Add migration system to convert Unix timestamps to datetime strings - Integrate migration into FastAPI lifespan for automatic startup execution - Update balance persistence to use consistent ISO datetime format - Fix mixed timestamp types causing API parsing issues - Add comprehensive error handling and progress logging - Successfully migrated 7522 balance records to consistent format
This commit is contained in:
committed by
Elisiário Couto
parent
dcac53d181
commit
34501f5f0d
@@ -24,6 +24,17 @@ async def lifespan(app: FastAPI):
|
||||
logger.error(f"Failed to load configuration: {e}")
|
||||
raise
|
||||
|
||||
# Run database migrations
|
||||
try:
|
||||
from leggend.services.database_service import DatabaseService
|
||||
|
||||
db_service = DatabaseService()
|
||||
await db_service.run_migrations_if_needed()
|
||||
logger.info("Database migrations completed")
|
||||
except Exception as e:
|
||||
logger.error(f"Database migration failed: {e}")
|
||||
raise
|
||||
|
||||
# Start background scheduler
|
||||
scheduler.start()
|
||||
logger.info("Background scheduler started")
|
||||
|
||||
Reference in New Issue
Block a user