mirror of
https://github.com/sstent/foodplanner.git
synced 2026-01-25 11:11:36 +00:00
added alembic database migrations, json import/export
This commit is contained in:
9
main.py
9
main.py
@@ -325,7 +325,14 @@ def scheduled_backup():
|
||||
@app.on_event("startup")
|
||||
def startup_event():
|
||||
logging.info("FastAPI application startup event triggered.")
|
||||
run_migrations()
|
||||
try:
|
||||
run_migrations()
|
||||
logging.info("Database migrations completed successfully in startup_event.")
|
||||
except Exception as e:
|
||||
logging.error(f"Error during database migrations in startup_event: {e}")
|
||||
# Depending on severity, you might want to re-raise or handle differently
|
||||
# raise
|
||||
|
||||
# Schedule the backup job
|
||||
scheduler = BackgroundScheduler()
|
||||
scheduler.add_job(scheduled_backup, 'cron', hour=0)
|
||||
|
||||
Reference in New Issue
Block a user