From 7931ae5e7513a7e2a3689a5ec3609fa2840d5a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Srokosz?= Date: Wed, 18 Dec 2024 19:51:02 +0100 Subject: [PATCH] Bump sqlalchemy to 1.4 and database-related dependencies (#1009) --- mwdb/model/object.py | 8 +++++--- mwdb/model/user.py | 2 +- requirements.txt | 10 +++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/mwdb/model/object.py b/mwdb/model/object.py index c5b4e4c3..256dfa74 100644 --- a/mwdb/model/object.py +++ b/mwdb/model/object.py @@ -58,12 +58,14 @@ class Object(db.Model): share_3rd_party = db.Column(db.Boolean, nullable=False) upload_count = column_property( - select([func.count(distinct(ObjectPermission.related_user_id))]).where( + select([func.count(distinct(ObjectPermission.related_user_id))]) + .where( and_( ObjectPermission.object_id == id, ObjectPermission.reason_type == AccessType.ADDED, ) - ), + ) + .scalar_subquery(), deferred=True, ) @@ -105,7 +107,7 @@ class Object(db.Model): "User", secondary="comment", back_populates="commented_objects", - passive_deletes=True, + viewonly=True, ) shares = db.relationship( diff --git a/mwdb/model/user.py b/mwdb/model/user.py index 9c697d06..1bdf30c8 100644 --- a/mwdb/model/user.py +++ b/mwdb/model/user.py @@ -68,7 +68,7 @@ class User(db.Model): "Object", secondary="comment", back_populates="comment_authors", - passive_deletes=True, + viewonly=True, ) comments = db.relationship( diff --git a/requirements.txt b/requirements.txt index 88ef86cc..75a04315 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,12 @@ Werkzeug==3.0.6 gunicorn==22.0.0 -alembic==1.4.2 +alembic==1.14.0 Flask==2.3.3 -Flask-SQLAlchemy==2.5.1 -Flask-Migrate==3.1.0 -SQLAlchemy==1.3.18 +Flask-SQLAlchemy==3.0.5 +Flask-Migrate==4.0.7 +SQLAlchemy==1.4.54 marshmallow==3.20.2 -psycopg2-binary==2.9.9 +psycopg2-binary==2.9.10 requests==2.32.0 apispec[marshmallow,yaml]==6.4.0 bcrypt==3.1.4