mirror of
https://github.com/sstent/foodplanner.git
synced 2026-04-05 20:43:51 +00:00
added alembic database migrations, json import/export
This commit is contained in:
@@ -56,7 +56,7 @@ job "foodplanner" {
|
|||||||
# Mount the SQLite database file to persist data
|
# Mount the SQLite database file to persist data
|
||||||
# Adjust the source path as needed for your environment
|
# Adjust the source path as needed for your environment
|
||||||
volumes = [
|
volumes = [
|
||||||
"/alloc/tmp/:/data/",
|
"/alloc/tmp/:/app/data/",
|
||||||
"/mnt/Public/configs/FoodPlanner_backups:/backups",
|
"/mnt/Public/configs/FoodPlanner_backups:/backups",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
9
main.py
9
main.py
@@ -324,14 +324,7 @@ def scheduled_backup():
|
|||||||
|
|
||||||
@app.on_event("startup")
|
@app.on_event("startup")
|
||||||
def startup_event():
|
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
|
# Schedule the backup job
|
||||||
scheduler = BackgroundScheduler()
|
scheduler = BackgroundScheduler()
|
||||||
|
|||||||
Reference in New Issue
Block a user