Skip to content

Commit 03f9898

Browse files
authored
[FIX] alembic migration (#1178)
* speed up slow query * do not remove the partitioned embedding tables
1 parent 0d63c83 commit 03f9898

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

store/backend/manage.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,25 @@
1717
app.config.from_object(os.environ["APP_SETTINGS"])
1818

1919

20-
migrate = Migrate(app, db, directory=app.config["MIGRATIONS_DIR"])
20+
def include_object(obj, name, type_, reflected, compare_to):
21+
# Skip partitions/objects created on the fly for vector embeddings; Alembic must ignore them.
22+
if type_ == "table" and name.startswith("pipeline_embeddings_"):
23+
return False
24+
if (
25+
type_ in {"index", "constraint"}
26+
and name.startswith("pe_")
27+
and (name.endswith("_hnsw") or name.endswith("_dims_chk"))
28+
):
29+
return False
30+
return True
31+
32+
33+
migrate = Migrate(
34+
app,
35+
db,
36+
directory=app.config["MIGRATIONS_DIR"],
37+
include_object=include_object,
38+
)
2139
migrate.init_app(app, db)
2240

2341

0 commit comments

Comments
 (0)