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

Daniel356b6748c926
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index d0d29880d2..d8cff26037 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -852,19 +852,21 @@ func updateAttributeViewColRelation(operation *Operation) (err error) {
}
if !destAdded {
- destAv.KeyValues = append(destAv.KeyValues, &av.KeyValues{
- Key: &av.Key{
- ID: operation.BackRelationKeyID,
- Name: operation.Name,
- Type: av.KeyTypeRelation,
- Relation: &av.Relation{AvID: operation.AvID, IsTwoWay: operation.IsTwoWay, BackKeyID: operation.KeyID},
- },
- })
+ if operation.IsTwoWay {
+ destAv.KeyValues = append(destAv.KeyValues, &av.KeyValues{
+ Key: &av.Key{
+ ID: operation.BackRelationKeyID,
+ Name: operation.Name,
+ Type: av.KeyTypeRelation,
+ Relation: &av.Relation{AvID: operation.AvID, IsTwoWay: operation.IsTwoWay, BackKeyID: operation.KeyID},
+ },
+ })
- for _, v := range destAv.Views {
- switch v.LayoutType {
- case av.LayoutTypeTable:
- v.Table.Columns = append(v.Table.Columns, &av.ViewTableColumn{ID: operation.KeyID})
+ for _, v := range destAv.Views {
+ switch v.LayoutType {
+ case av.LayoutTypeTable:
+ v.Table.Columns = append(v.Table.Columns, &av.ViewTableColumn{ID: operation.KeyID})
+ }
}
}
}