Commit ee38449
committed
refactor: improve PostgreSQL migration code quality
Why this change is needed:
1. Added clarifying comments to _pg_migrate_workspace_data() parameter handling
2. Removed dead code from PGDocStatusStorage.initialize() that was never executed
Changes:
1. PostgreSQL Migration Parameter Documentation (lightrag/kg/postgres_impl.py:2240-2241):
- Added comments explaining dict rebuild for correct value ordering
- Clarifies that Python 3.7+ dict insertion order is relied upon
- Documents that execute() converts dict to tuple via .values()
2. Dead Code Removal (lightrag/kg/postgres_impl.py:3061-3062):
- Removed unreachable table creation code from PGDocStatusStorage.initialize()
- Table is already created by PostgreSQLDB.initdb() during initialization
- This code path was never executed as table always exists before initialize() is called
- Added NOTE comment explaining where table creation actually happens
Impact:
- No functional changes - only code clarification and cleanup
- Reduces maintenance burden by removing unreachable code
- Improves code readability with better documentation
Testing:
- All 14 PostgreSQL migration tests pass
- All 5 UnifiedLock safety tests pass
- Pre-commit checks pass (ruff-format, ruff)1 parent 0fb7c5b commit ee38449
1 file changed
+4
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2237 | 2237 | | |
2238 | 2238 | | |
2239 | 2239 | | |
| 2240 | + | |
| 2241 | + | |
2240 | 2242 | | |
2241 | 2243 | | |
2242 | 2244 | | |
| |||
3058 | 3060 | | |
3059 | 3061 | | |
3060 | 3062 | | |
3061 | | - | |
3062 | | - | |
3063 | | - | |
3064 | | - | |
3065 | | - | |
| 3063 | + | |
| 3064 | + | |
3066 | 3065 | | |
3067 | 3066 | | |
3068 | 3067 | | |
| |||
0 commit comments