mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-26 11:28:49 +01:00
🎨 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:
parent
75da247b23
commit
0bea01ad3b
8 changed files with 262 additions and 37 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue