From 7d8b5df046f2c1464ceae52503930222c70d8b84 Mon Sep 17 00:00:00 2001 From: Stef Date: Tue, 2 Sep 2025 10:00:12 +0200 Subject: [PATCH] Creates db and assumes it's up to date. This replaces init() --- app.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index 72874a9..2cbccf3 100644 --- a/app.py +++ b/app.py @@ -1,19 +1,19 @@ # import requests as r from flask import jsonify, render_template, send_file from poll_services import start_async_loop -from mem import services, app +from mem import services, app, db import threading -from flask_migrate import init, upgrade +from flask_migrate import upgrade, stamp from pathlib import Path # Init and upgrade with app.app_context(): - # Check if DB file or migrations folder is missing - if not ( - Path("./instance/app.db").is_file() and Path("./migrations").is_dir() - ): - init() + # Check if DB file is missing + if not (Path("./instance/app.db").is_file()): + with app.app_context(): + db.create_all() + stamp() # Upgrade db if any new migrations exist upgrade()