mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-17 12:38:07 +01:00
🎨 Maintain relationships between database blocks and database storage Fix https://github.com/siyuan-note/siyuan/issues/9496
This commit is contained in:
parent
af6036eefe
commit
903b046ce1
2 changed files with 105 additions and 0 deletions
|
|
@ -712,6 +712,10 @@ func (tx *Transaction) doDelete(operation *Operation) (ret *TxErr) {
|
|||
}
|
||||
|
||||
syncDelete2AttributeView(node)
|
||||
if ast.NodeAttributeView == node.Type {
|
||||
avID := node.AttributeViewID
|
||||
av.RemoveBlockRel(avID, node.ID)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -898,6 +902,11 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
|
|||
return &TxErr{code: TxErrCodeWriteTree, msg: err.Error(), id: block.ID}
|
||||
}
|
||||
|
||||
if ast.NodeAttributeView == insertedNode.Type {
|
||||
avID := insertedNode.AttributeViewID
|
||||
av.UpsertBlockRel(avID, insertedNode.ID)
|
||||
}
|
||||
|
||||
operation.ID = insertedNode.ID
|
||||
operation.ParentID = insertedNode.Parent.ID
|
||||
return
|
||||
|
|
@ -986,6 +995,11 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
|
|||
if err = tx.writeTree(tree); nil != err {
|
||||
return &TxErr{code: TxErrCodeWriteTree, msg: err.Error(), id: id}
|
||||
}
|
||||
|
||||
if ast.NodeAttributeView == updatedNode.Type {
|
||||
avID := updatedNode.AttributeViewID
|
||||
av.UpsertBlockRel(avID, updatedNode.ID)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue