From 9c3e53004c855f6f01c8fe709645c6ece6ca2102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B1=9F=E6=B3=A2?= Date: Mon, 16 Dec 2024 19:37:41 +0800 Subject: [PATCH] fix: Tables like embedding_vector_index_***_nod are ignored during database migration. --- api/migrations/env.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/migrations/env.py b/api/migrations/env.py index ad3a122c04bc2d..3f06e6394b7efd 100644 --- a/api/migrations/env.py +++ b/api/migrations/env.py @@ -1,4 +1,5 @@ import logging +import re from logging.config import fileConfig from alembic import context @@ -33,6 +34,7 @@ def get_engine_url(): config.set_main_option('sqlalchemy.url', get_engine_url()) target_db = current_app.extensions['migrate'].db + # other values from the config, defined by the needs of env.py, # can be acquired: # my_important_option = config.get_main_option("my_important_option") @@ -48,6 +50,8 @@ def get_metadata(): def include_object(object, name, type_, reflected, compare_to): if type_ == "foreign_key_constraint": return False + elif type_ == "table" and re.match(r"^embedding_vector_index_.*?_nod$", name): + return False else: return True @@ -110,4 +114,3 @@ def process_revision_directives(context, revision, directives): run_migrations_offline() else: run_migrations_online() -