mirror of
https://github.com/StefBuwalda/dashboard_test.git
synced 2025-11-01 12:19:58 +00:00
Creates db and assumes it's up to date. This replaces init()
This commit is contained in:
14
app.py
14
app.py
@@ -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()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user