jack 1 ماه پیش
والد
کامیت
ee6e0cca59
2فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 3 0
      py/core/main/services/management_service.py
  2. 3 1
      py/core/providers/database/collections.py

+ 3 - 0
py/core/main/services/management_service.py

@@ -578,13 +578,16 @@ class ManagementService(Service):
         )
         )
 
 
     async def delete_collection(self, collection_id: UUID) -> bool:
     async def delete_collection(self, collection_id: UUID) -> bool:
+        logger.info(f"Deleting collection {collection_id}")
         await self.providers.database.collections_handler.delete_collection_relational(
         await self.providers.database.collections_handler.delete_collection_relational(
             collection_id
             collection_id
         )
         )
+        logger.info(f"Deleting collection {collection_id} from chunks")
         await self.providers.database.chunks_handler.delete_collection_vector(
         await self.providers.database.chunks_handler.delete_collection_vector(
             collection_id
             collection_id
         )
         )
         try:
         try:
+            logger.info(f"Deleting collection {collection_id} from graph")
             await self.providers.database.graphs_handler.delete(
             await self.providers.database.graphs_handler.delete(
                 collection_id=collection_id,
                 collection_id=collection_id,
             )
             )

+ 3 - 1
py/core/providers/database/collections.py

@@ -260,10 +260,12 @@ class PostgresCollectionsHandler(Handler):
             SET collection_ids = array_remove(collection_ids, $1)
             SET collection_ids = array_remove(collection_ids, $1)
             WHERE $1 = ANY(collection_ids)
             WHERE $1 = ANY(collection_ids)
         """
         """
+        logger.info(f"Deleting collection {collection_id} from users")
         await self.connection_manager.execute_query(
         await self.connection_manager.execute_query(
             user_update_query, [collection_id]
             user_update_query, [collection_id]
         )
         )
 
 
+        logger.info(f"Deleting collection1 {collection_id} from documents")
         # Remove collection_id from documents
         # Remove collection_id from documents
         document_update_query = f"""
         document_update_query = f"""
             WITH updated AS (
             WITH updated AS (
@@ -277,7 +279,7 @@ class PostgresCollectionsHandler(Handler):
         await self.connection_manager.fetchrow_query(
         await self.connection_manager.fetchrow_query(
             document_update_query, [collection_id]
             document_update_query, [collection_id]
         )
         )
-
+        logger.info(f"Deleting collection2 {collection_id} from documents")
         # Delete the collection
         # Delete the collection
         delete_query = f"""
         delete_query = f"""
             DELETE FROM {self._get_table_name(PostgresCollectionsHandler.TABLE_NAME)}
             DELETE FROM {self._get_table_name(PostgresCollectionsHandler.TABLE_NAME)}