优化加载后删除节点的逻辑;和数据库查询性能

This commit is contained in:
strepsiades
2026-04-02 19:31:04 +08:00
parent 74df53889c
commit 543c3ff906
17 changed files with 571 additions and 32 deletions
@@ -55,4 +55,22 @@ async def test_scope_partitioning_and_copy_between_scopes(tmp_path: Path) -> Non
await reloaded_global.load_from_persistence()
assert len(reloaded_global.filter(node_type="test_project")) == 1
await persistence.close()
@pytest.mark.asyncio
async def test_sqlite_backend_creates_restore_join_index(tmp_path: Path) -> None:
db_path = tmp_path / "scope_partitioning.db"
persistence = SQLitePersistenceBackend(str(db_path))
await persistence.initialize()
columns, rows = PersistenceBackend.query_records(
backend="sqlite",
db_path=str(db_path),
sql="PRAGMA index_list('nodes')",
)
assert columns == ["seq", "name", "unique", "origin", "partial"]
assert any(row["name"] == "idx_nodes_scope_type_node_id" for row in rows)
await persistence.close()