🎨 Add Include time switch to database creation time field and update time field https://github.com/siyuan-note/siyuan/issues/12091

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-11-07 21:25:03 +08:00
parent 75da247b23
commit 0bea01ad3b
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
8 changed files with 262 additions and 37 deletions

View file

@ -24,10 +24,38 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
const CurrentSpec = 4
func UpgradeSpec(av *AttributeView) {
if CurrentSpec <= av.Spec {
return
}
upgradeSpec1(av)
upgradeSpec2(av)
upgradeSpec3(av)
upgradeSpec4(av)
}
func upgradeSpec4(av *AttributeView) {
if 4 <= av.Spec {
return
}
for _, keyValues := range av.KeyValues {
switch keyValues.Key.Type {
case KeyTypeCreated:
if nil == keyValues.Key.Created {
keyValues.Key.Created = &Created{IncludeTime: true}
}
case KeyTypeUpdated:
if nil == keyValues.Key.Updated {
keyValues.Key.Updated = &Updated{IncludeTime: true}
}
}
}
av.Spec = 4
}
func upgradeSpec3(av *AttributeView) {