mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-08 00:04:21 +01:00
🎨 Improve init db
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
781144a60d
commit
b059496eb6
1 changed files with 5 additions and 4 deletions
|
|
@ -95,12 +95,13 @@ func InitDatabase(forceRebuild bool) (err error) {
|
|||
|
||||
// 不存在库或者版本不一致都会走到这里
|
||||
|
||||
closeDatabase()
|
||||
if err = closeDatabase(); nil != err {
|
||||
logging.LogFatalf(logging.ExitCodeUnavailableDatabase, "close database failed: %s", err)
|
||||
}
|
||||
|
||||
if gulu.File.IsExist(util.DBPath) {
|
||||
if err = removeDatabaseFile(); err != nil {
|
||||
logging.LogErrorf("remove database file [%s] failed: %s", util.DBPath, err)
|
||||
util.PushClearProgress()
|
||||
err = nil
|
||||
logging.LogFatalf(logging.ExitCodeUnavailableDatabase, "remove database file [%s] failed: %s", util.DBPath, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue