Replace db.Model with DeclarativeBase from SQLAlchemy for Flask-SQLAlchemy-Lite migration

This commit is contained in:
2026-04-06 01:49:44 +08:00
parent e6d25882fc
commit 9c6cc1f3eb
8 changed files with 49 additions and 24 deletions
+5 -1
View File
@@ -13,7 +13,7 @@ The following is an example configuration for *Mia! Accounting*.
from flask import Response, redirect
from .auth import current_user()
from .modules import User
from .modules import Base, User
def create_app(test_config=None) -> Flask:
app: Flask = Flask(__name__)
@@ -36,6 +36,10 @@ The following is an example configuration for *Mia! Accounting*.
def unauthorized(self) -> Response:
return redirect("/login")
@property
def base(self) -> type[DeclarativeBase]:
return Base
@property
def cls(self) -> type[User]:
return User