Check table_names() before dropping chunks in recreate_embeddings_table

This commit is contained in:
Yiorgis Gozadinos 2026-04-24 15:32:06 +03:00
parent 729899299b
commit b23bad32c3
No known key found for this signature in database

View file

@ -586,11 +586,12 @@ class Store:
ReadOnlyError: If the store is in read-only mode.
"""
self._assert_writable()
# Drop and recreate chunks table
try:
# Drop and recreate chunks table. Check existence first rather than
# catching-and-swallowing drop_table's errors — a catch-all would
# hide real failures (permissions, storage-backend errors) and then
# the subsequent create_table would fail confusingly.
if "chunks" in await self.db.table_names():
await self.db.drop_table("chunks")
except Exception:
pass
# Update the ChunkRecord model with new vector dimension
self.ChunkRecord = create_chunk_model(self.embedder._vector_dim)