Skip to content

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

:art: Add Relation column to database table view https://github.com/siyuan-note/siyuan/issues/9888

Daniel8b12b51c52ee
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index d96fb75c7a..a4cd1e6e9e 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -878,6 +878,7 @@ func updateAttributeViewColRelation(operation *Operation) (err error) {
// operation.IsTwoWay 是否双向关联
// operation.BackRelationKeyID 双向关联的目标关联列 ID
// operation.Name 双向关联的目标关联列名称
+ // operation.Format 源 av 关联列名称
srcAv, err := av.ParseAttributeView(operation.AvID)
if nil != err {
@@ -934,6 +935,7 @@ func updateAttributeViewColRelation(operation *Operation) (err error) {
srcRel.BackKeyID = ""
}
keyValues.Key.Relation = srcRel
+ keyValues.Key.Name = operation.Format
break
}
@@ -950,9 +952,9 @@ func updateAttributeViewColRelation(operation *Operation) (err error) {
if operation.IsTwoWay {
name := strings.TrimSpace(operation.Name)
if "" == name {
- name = srcAv.Name
+ name = srcAv.Name + " " + operation.Format
}
- backRelKey.Name = name
+ backRelKey.Name = strings.TrimSpace(name)
}
}
@@ -960,7 +962,7 @@ func updateAttributeViewColRelation(operation *Operation) (err error) {
if operation.IsTwoWay {
name := strings.TrimSpace(operation.Name)
if "" == name {
- name = srcAv.Name
+ name = srcAv.Name + " " + operation.Format
}
destAv.KeyValues = append(destAv.KeyValues, &av.KeyValues{