MAJOR REFACTOR P1

This commit is contained in:
2025-09-05 20:39:42 +02:00
parent 3b87da9292
commit 4cfd5b2dbe
28 changed files with 293 additions and 301 deletions

21
app/__init__.py Normal file
View File

@@ -0,0 +1,21 @@
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate, upgrade, stamp
from .flask_app import app
from pathlib import Path
__all__ = ["app"]
# Create db
db = SQLAlchemy(app=app)
# Set up migration
migration = Migrate(app=app, db=db)
# Init and upgrade
with app.app_context():
# Check if DB file is missing
if not (Path("./instance/app.db").is_file()):
db.create_all()
stamp()
# Upgrade db if any new migrations exist
upgrade()