From e91531fc2371d649aa74a473f27ae446248605b5 Mon Sep 17 00:00:00 2001 From: Naoki KOBAYASHI Date: Tue, 18 Mar 2025 15:15:48 +0900 Subject: [PATCH] fix: error in migrate_annotation_vector_database when exec vdb-migrate (#15937) Co-authored-by: crazywoola <427733928@qq.com> --- api/commands.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api/commands.py b/api/commands.py index f97fa86448..df67f29aff 100644 --- a/api/commands.py +++ b/api/commands.py @@ -160,11 +160,17 @@ def migrate_annotation_vector_database(): while True: try: # get apps info + per_page = 50 apps = ( - App.query.filter(App.status == "normal") + db.session.query(App) + .filter(App.status == "normal") .order_by(App.created_at.desc()) - .paginate(page=page, per_page=50) + .limit(per_page) + .offset((page - 1) * per_page) + .all() ) + if not apps: + break except NotFound: break