Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Add the parent_id index for table blocks https://github.com/siyuan-note/siyuan/issues/12054

Danielb763b4d4827a
diff --git a/kernel/sql/database.go b/kernel/sql/database.go
index fafbf32003..870d4dc495 100644
--- a/kernel/sql/database.go
+++ b/kernel/sql/database.go
@@ -135,6 +135,11 @@ func initDBTables() {
logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create index [idx_blocks_id] failed: %s", err)
}
+ _, err = db.Exec("CREATE INDEX idx_blocks_parent_id ON blocks(parent_id)")
+ if nil != err {
+ logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create index [idx_blocks_parent_id] failed: %s", err)
+ }
+
_, err = db.Exec("CREATE INDEX idx_blocks_root_id ON blocks(root_id)")
if nil != err {
logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create index [idx_blocks_root_id] failed: %s", err)