From 55ea50da32695423693a1a7973d4ec35d5dd3a5b Mon Sep 17 00:00:00 2001 From: Xiaoxia Agent Date: Tue, 6 Oct 2026 17:42:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20migration=20100=20S?= =?UTF-8?q?QL=20=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=BC=95=E5=8F=B7=EF=BC=88?= =?UTF-8?q?=E5=8F=8D=E6=96=9C=E6=9D=A0=E6=94=B9=E4=B8=BA=E5=8D=95=E5=BC=95?= =?UTF-8?q?=E5=8F=B7=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../100_fix_capability_model_bindings.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/alembic/versions/100_fix_capability_model_bindings.py b/alembic/versions/100_fix_capability_model_bindings.py index 29be5f7ad..c21bfcdc7 100644 --- a/alembic/versions/100_fix_capability_model_bindings.py +++ b/alembic/versions/100_fix_capability_model_bindings.py @@ -23,18 +23,18 @@ def upgrade() -> None: conn = op.get_bind() # 检查表是否存在 - table_check = conn.execute(sa.text("SELECT to_regclass(\public.ai_models\)")).scalar() + table_check = conn.execute(sa.text("SELECT to_regclass('public.ai_models')")).scalar() if not table_check: return - config_table_check = conn.execute(sa.text("SELECT to_regclass(\public.ai_capability_configs\)")).scalar() + config_table_check = conn.execute(sa.text("SELECT to_regclass('public.ai_capability_configs')")).scalar() if not config_table_check: return # 查询目标模型的 ID(使用 model_key 查询,不硬编码 UUID) pro_model_row = conn.execute( sa.text( - "SELECT id FROM ai_models WHERE model_key = \doubao-seed-2-1-pro-260915\ AND deleted_at IS NULL LIMIT 1" + "SELECT id FROM ai_models WHERE model_key = 'doubao-seed-2-1-pro-260915' AND deleted_at IS NULL LIMIT 1" ) ).first() if not pro_model_row: @@ -43,7 +43,7 @@ def upgrade() -> None: # 查询旧模型 ID old_model_row = conn.execute( - sa.text("SELECT id FROM ai_models WHERE model_key = \doubao-seed-1-6-250615\ LIMIT 1") + sa.text("SELECT id FROM ai_models WHERE model_key = 'doubao-seed-1-6-250615' LIMIT 1") ).first() old_model_id = old_model_row[0] if old_model_row else None @@ -66,10 +66,10 @@ def upgrade() -> None: # 更新 image_analysis qwen38_row = conn.execute( - sa.text("SELECT id FROM ai_models WHERE model_key = \qwen3.8-flash\ AND deleted_at IS NULL LIMIT 1") + sa.text("SELECT id FROM ai_models WHERE model_key = 'qwen3.8-flash' AND deleted_at IS NULL LIMIT 1") ).first() qwen37_row = conn.execute( - sa.text("SELECT id FROM ai_models WHERE model_key = \qwen3.7-plus\ AND deleted_at IS NULL LIMIT 1") + sa.text("SELECT id FROM ai_models WHERE model_key = 'qwen3.7-plus' AND deleted_at IS NULL LIMIT 1") ).first() if qwen38_row and qwen37_row: @@ -78,7 +78,7 @@ def upgrade() -> None: current_ia = conn.execute( sa.text( - "SELECT primary_model_id, lite_model_id, fallback_model_id FROM ai_capability_configs WHERE capability_key = \image_analysis" + "SELECT primary_model_id, lite_model_id, fallback_model_id FROM ai_capability_configs WHERE capability_key = 'image_analysis'" ) ).first() @@ -104,12 +104,12 @@ def upgrade() -> None: def downgrade() -> None: conn = op.get_bind() - table_check = conn.execute(sa.text("SELECT to_regclass(\public.ai_models\)")).scalar() + table_check = conn.execute(sa.text("SELECT to_regclass('public.ai_models')")).scalar() if not table_check: return old_model_row = conn.execute( - sa.text("SELECT id FROM ai_models WHERE model_key = \doubao-seed-1-6-250615\ LIMIT 1") + sa.text("SELECT id FROM ai_models WHERE model_key = 'doubao-seed-1-6-250615' LIMIT 1") ).first() if not old_model_row: return