🎨 Improve database handling when importing .sy.zip https://github.com/siyuan-note/siyuan/issues/11628
This commit is contained in:
parent
68c3f8091c
commit
cf5ff5283a
1 changed files with 19 additions and 0 deletions
|
@ -312,6 +312,25 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
|
|||
attrViewIDs = append(attrViewIDs, avID)
|
||||
}
|
||||
updateBoundBlockAvsAttribute(attrViewIDs)
|
||||
|
||||
// 插入关联关系 https://github.com/siyuan-note/siyuan/issues/11628
|
||||
relationAvs := map[string]string{}
|
||||
for _, avID := range avIDs {
|
||||
attrView, _ := av.ParseAttributeView(avID)
|
||||
if nil == attrView {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, keyValues := range attrView.KeyValues {
|
||||
if nil != keyValues.Key && av.KeyTypeRelation == keyValues.Key.Type && nil != keyValues.Key.Relation {
|
||||
relationAvs[avID] = keyValues.Key.Relation.AvID
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for srcAvID, destAvID := range relationAvs {
|
||||
av.UpsertAvBackRel(srcAvID, destAvID)
|
||||
}
|
||||
}
|
||||
|
||||
// 将关联的闪卡数据合并到默认卡包 data/storage/riff/20230218211946-2kw8jgx 中
|
||||
|
|
Loading…
Add table
Reference in a new issue