LightRAG/lightrag
BukeLy ad68624d02 feat: PostgreSQL model isolation and auto-migration
Why this change is needed:
PostgreSQL vector storage needs model isolation to prevent dimension
conflicts when different workspaces use different embedding models.
Without this, the first workspace locks the vector dimension for all
subsequent workspaces, causing failures.

How it solves it:
- Implements dynamic table naming with model suffix: {table}_{model}_{dim}d
- Adds setup_table() method mirroring Qdrant's approach for consistency
- Implements 4-branch migration logic: both exist -> warn, only new -> use,
  neither -> create, only legacy -> migrate
- Batch migration: 500 records/batch (same as Qdrant)
- No automatic rollback to support idempotent re-runs

Impact:
- PostgreSQL tables now isolated by embedding model and dimension
- Automatic data migration from legacy tables on startup
- Backward compatible: model_name=None defaults to "unknown"
- All SQL operations use dynamic table names

Testing:
- 6 new tests for PostgreSQL migration (100% pass)
- Tests cover: naming, migration trigger, scenarios 1-3
- 3 additional scenario tests added for Qdrant completeness

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 22:54:37 +08:00
..
api Bump API version to 0256 2025-11-18 23:15:31 +08:00
evaluation Update LLM cache migration docs and improve UX prompts 2025-11-08 23:48:19 +08:00
kg feat: PostgreSQL model isolation and auto-migration 2025-11-19 22:54:37 +08:00
llm Improve Bedrock error handling with retry logic and custom exceptions 2025-11-17 12:54:32 +08:00
tools Improve LightRAG initialization checker tool with better usage docs 2025-11-17 15:42:54 +08:00
__init__.py Bump core version to 1.4.9.9 and API to 0252 2025-11-08 11:27:26 +08:00
base.py feat: enhance BaseVectorStorage for model isolation 2025-11-19 02:15:22 +08:00
constants.py Refactor entity merging with unified attribute merge function 2025-10-27 00:04:17 +08:00
exceptions.py Auto-initialize pipeline status in LightRAG.initialize_storages() 2025-11-17 12:54:33 +08:00
lightrag.py Fix linting 2025-11-18 22:38:43 +08:00
namespace.py Add entity/relation chunk tracking with configurable source ID limits 2025-10-20 15:24:15 +08:00
operate.py Adjust chunking parameters to match the default environment variable settings 2025-11-18 23:14:50 +08:00
prompt.py Fix typo in 'equipment' in prompt.py 2025-10-22 11:13:22 +08:00
rerank.py
types.py
utils.py feat: enhance EmbeddingFunc with model_name support 2025-11-19 02:11:39 +08:00
utils_graph.py Improve entity merge logging by removing redundant message and fixing typo 2025-10-31 17:16:59 +08:00