Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-02-02 18:27:19 +08:00
commit faa31614d1
10 changed files with 57 additions and 20 deletions

View file

@ -996,7 +996,7 @@
"105": "Corrupted data repo have been automatically reset",
"106": "Maximum length is limited to 512 characters",
"107": "Moving document [%s]",
"108": "TODO",
"108": "Rebuild index complete",
"109": "Remove reminder completed [%s]",
"110": "Renaming...",
"111": "Saving document [%s]...",

View file

@ -996,7 +996,7 @@
"105": "El repositorio de datos corruptos se ha restablecido automáticamente",
"106": "La longitud máxima está limitada a 512 caracteres",
"107": "Moviendo documento [%s]",
"108": "TODO",
"108": "Reconstrucción del índice completada",
"109": "Eliminación de recordatorios completada [%s]",
"110": "Renombrar...",
"111": "Guardando documento [%s]...",

View file

@ -996,7 +996,7 @@
"105": "Le référentiel de données corrompu a été automatiquement réinitialisé",
"106": "La longueur maximale est limitée à 512 caractères",
"107": "Déplacement du document [%s]",
"108": "TODO",
"108": "Reconstruire l'index terminé",
"109": "Supprimer le rappel terminé [%s]",
"110": "Renommer...",
"111": "Enregistrement du document [%s]...",

View file

@ -996,7 +996,7 @@
"105": "已經自動重置損壞的數據倉庫",
"106": "最大長度限制為 512 字元",
"107": "正在移動文檔 [%s]",
"108": "TODO",
"108": "重建索引完畢",
"109": "移除提醒完畢 [%s]",
"110": "正在重命名...",
"111": "正在保存文檔 [%s]...",

View file

@ -996,7 +996,7 @@
"105": "已经自动重置损坏的数据仓库",
"106": "最大长度限制为 512 字符",
"107": "正在移动文档 [%s]",
"108": "TODO",
"108": "重建索引完毕",
"109": "移除提醒完毕 [%s]",
"110": "正在重命名...",
"111": "正在保存文档 [%s]...",

File diff suppressed because one or more lines are too long

View file

@ -6,7 +6,7 @@ require (
github.com/88250/clipboard v0.1.5
github.com/88250/css v0.1.2
github.com/88250/gulu v1.2.3-0.20221117052724-cd06804db798
github.com/88250/lute v1.7.6-0.20230202065128-4cbf76e24dcb
github.com/88250/lute v1.7.6-0.20230202080810-fb6e2ab9a397
github.com/88250/pdfcpu v0.3.13
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732

View file

@ -17,8 +17,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXS
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20221117052724-cd06804db798 h1:sR/s/Y9wyl79ZRCUERwLPo9zqaB3KhNRodCMTJ4ozEU=
github.com/88250/gulu v1.2.3-0.20221117052724-cd06804db798/go.mod h1:I1qBzsksFL2ciGSuqDE7R3XW4BUMrfDgOvSXEk7FsAI=
github.com/88250/lute v1.7.6-0.20230202065128-4cbf76e24dcb h1:cQFmZHUrHnYceHyv2gHMm8xkP8C3Y+I9+7zUJhLADlk=
github.com/88250/lute v1.7.6-0.20230202065128-4cbf76e24dcb/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
github.com/88250/lute v1.7.6-0.20230202080810-fb6e2ab9a397 h1:+sFvet7KZN9icw5sWMSCS4mejrG+A5wVzPQAdCR7QP8=
github.com/88250/lute v1.7.6-0.20230202080810-fb6e2ab9a397/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
github.com/88250/pdfcpu v0.3.13 h1:touMWMZkCGalMIbEg9bxYp7rETM+zwb9hXjwhqi4I7Q=
github.com/88250/pdfcpu v0.3.13/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

View file

@ -518,6 +518,10 @@ func fullReindex() {
treenode.SaveBlockTree(true)
LoadFlashcards()
runtime.GC()
go func() {
time.Sleep(3 * time.Second)
util.PushStatusBar(Conf.Language(108))
}()
}
func ChangeBoxSort(boxIDs []string) {

View file

@ -26,6 +26,7 @@ import (
"regexp"
"runtime"
"strings"
"sync"
"time"
"unicode/utf8"
@ -59,7 +60,12 @@ func init() {
})
}
var initDatabaseLock = sync.Mutex{}
func InitDatabase(forceRebuild bool) (err error) {
initDatabaseLock.Lock()
defer initDatabaseLock.Unlock()
ClearBlockCache()
DisableCache()
defer EnableCache()
@ -102,56 +108,83 @@ func InitDatabase(forceRebuild bool) (err error) {
}
func initDBTables() {
db.Exec("DROP TABLE stat")
_, err := db.Exec("CREATE TABLE stat (key, value)")
_, err := db.Exec("DROP TABLE IF EXISTS stat")
if nil != err {
logging.LogFatalf("drop table [stat] failed: %s", err)
}
_, err = db.Exec("CREATE TABLE stat (key, value)")
if nil != err {
logging.LogFatalf("create table [stat] failed: %s", err)
}
setDatabaseVer()
db.Exec("DROP TABLE blocks")
_, err = db.Exec("DROP TABLE IF EXISTS blocks")
if nil != err {
logging.LogFatalf("drop table [blocks] failed: %s", err)
}
_, err = db.Exec("CREATE TABLE blocks (id, parent_id, root_id, hash, box, path, hpath, name, alias, memo, tag, content, fcontent, markdown, length, type, subtype, ial, sort, created, updated)")
if nil != err {
logging.LogFatalf("create table [blocks] failed: %s", err)
}
db.Exec("DROP TABLE blocks_fts")
_, err = db.Exec("DROP TABLE IF EXISTS blocks_fts")
if nil != err {
logging.LogFatalf("drop table [blocks_fts] failed: %s", err)
}
_, err = db.Exec("CREATE VIRTUAL TABLE blocks_fts USING fts5(id UNINDEXED, parent_id UNINDEXED, root_id UNINDEXED, hash UNINDEXED, box UNINDEXED, path UNINDEXED, hpath, name, alias, memo, tag, content, fcontent, markdown UNINDEXED, length UNINDEXED, type UNINDEXED, subtype UNINDEXED, ial, sort UNINDEXED, created UNINDEXED, updated UNINDEXED, tokenize=\"siyuan\")")
if nil != err {
logging.LogFatalf("create table [blocks_fts] failed: %s", err)
}
db.Exec("DROP TABLE blocks_fts_case_insensitive")
_, err = db.Exec("DROP TABLE IF EXISTS blocks_fts_case_insensitive")
if nil != err {
logging.LogFatalf("drop table [blocks_fts_case_insensitive] failed: %s", err)
}
_, err = db.Exec("CREATE VIRTUAL TABLE blocks_fts_case_insensitive USING fts5(id UNINDEXED, parent_id UNINDEXED, root_id UNINDEXED, hash UNINDEXED, box UNINDEXED, path UNINDEXED, hpath, name, alias, memo, tag, content, fcontent, markdown UNINDEXED, length UNINDEXED, type UNINDEXED, subtype UNINDEXED, ial, sort UNINDEXED, created UNINDEXED, updated UNINDEXED, tokenize=\"siyuan case_insensitive\")")
if nil != err {
logging.LogFatalf("create table [blocks_fts_case_insensitive] failed: %s", err)
}
db.Exec("DROP TABLE spans")
_, err = db.Exec("DROP TABLE IF EXISTS spans")
if nil != err {
logging.LogFatalf("drop table [spans] failed: %s", err)
}
_, err = db.Exec("CREATE TABLE spans (id, block_id, root_id, box, path, content, markdown, type, ial)")
if nil != err {
logging.LogFatalf("create table [spans] failed: %s", err)
}
db.Exec("DROP TABLE assets")
_, err = db.Exec("DROP TABLE IF EXISTS assets")
if nil != err {
logging.LogFatalf("drop table [assets] failed: %s", err)
}
_, err = db.Exec("CREATE TABLE assets (id, block_id, root_id, box, docpath, path, name, title, hash)")
if nil != err {
logging.LogFatalf("create table [assets] failed: %s", err)
}
db.Exec("DROP TABLE attributes")
_, err = db.Exec("DROP TABLE IF EXISTS attributes")
if nil != err {
logging.LogFatalf("drop table [attributes] failed: %s", err)
}
_, err = db.Exec("CREATE TABLE attributes (id, name, value, type, block_id, root_id, box, path)")
if nil != err {
logging.LogFatalf("create table [attributes] failed: %s", err)
}
db.Exec("DROP TABLE refs")
_, err = db.Exec("DROP TABLE IF EXISTS refs")
if nil != err {
logging.LogFatalf("drop table [refs] failed: %s", err)
}
_, err = db.Exec("CREATE TABLE refs (id, def_block_id, def_block_parent_id, def_block_root_id, def_block_path, block_id, root_id, box, path, content, markdown, type)")
if nil != err {
logging.LogFatalf("create table [refs] failed: %s", err)
}
db.Exec("DROP TABLE file_annotation_refs")
_, err = db.Exec("DROP TABLE IF EXISTS file_annotation_refs")
if nil != err {
logging.LogFatalf("drop table [refs] failed: %s", err)
}
_, err = db.Exec("CREATE TABLE file_annotation_refs (id, file_path, annotation_id, block_id, root_id, box, path, content, type)")
if nil != err {
logging.LogFatalf("create table [refs] failed: %s", err)