Creates db and assumes it's up to date. This replaces init()

This commit is contained in:
2025-09-02 10:00:12 +02:00
parent 3eb066922d
commit 7d8b5df046

14
app.py
View File

@@ -1,19 +1,19 @@
# import requests as r # import requests as r
from flask import jsonify, render_template, send_file from flask import jsonify, render_template, send_file
from poll_services import start_async_loop from poll_services import start_async_loop
from mem import services, app from mem import services, app, db
import threading import threading
from flask_migrate import init, upgrade from flask_migrate import upgrade, stamp
from pathlib import Path from pathlib import Path
# Init and upgrade # Init and upgrade
with app.app_context(): with app.app_context():
# Check if DB file or migrations folder is missing # Check if DB file is missing
if not ( if not (Path("./instance/app.db").is_file()):
Path("./instance/app.db").is_file() and Path("./migrations").is_dir() with app.app_context():
): db.create_all()
init() stamp()
# Upgrade db if any new migrations exist # Upgrade db if any new migrations exist
upgrade() upgrade()