Skip to content

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

:art: Supports multiple views for the database https://github.com/siyuan-note/siyuan/issues/9751

Daniel4d5071c31d8f
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 34839a0b16..d482436a3f 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -643,6 +643,10 @@ func (tx *Transaction) doRemoveAttrViewView(operation *Operation) (ret *TxErr) {
return &TxErr{code: TxErrCodeBlockNotFound, id: avID}
}
+ if 1 >= len(attrView.Views) {
+ return
+ }
+
viewID := operation.ID
for i, view := range attrView.Views {
if viewID == view.ID {
@@ -651,6 +655,7 @@ func (tx *Transaction) doRemoveAttrViewView(operation *Operation) (ret *TxErr) {
}
}
+ attrView.ViewID = attrView.Views[0].ID
if err = av.SaveAttributeView(attrView); nil != err {
logging.LogErrorf("save attribute view [%s] failed: %s", avID, err)
return &TxErr{code: TxErrCodeWriteTree, msg: err.Error(), id: avID}