Migrate from SQLAlchemy 1.x legacy Query API to 2.x style select/delete statements

This commit is contained in:
2026-04-06 01:06:01 +08:00
parent 356950e2c7
commit 970c2e9946
39 changed files with 372 additions and 275 deletions
+2 -2
View File
@@ -218,8 +218,8 @@ class BaseTestData(ABC):
self._app: Flask = app
"""The Flask application."""
with self._app.app_context():
current_user: User | None = User.query\
.filter(User.username == username).first()
current_user: User | None = db.session.scalar(
sa.select(User).where(User.username == username))
assert current_user is not None
self.__current_user_id: int = current_user.id
"""The current user ID."""