mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-19 05:28:07 +01:00
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
6c2545e457
commit
95242c3f4d
6 changed files with 45 additions and 45 deletions
|
|
@ -79,16 +79,16 @@ func initDatabase(forceRebuild bool) (err error) {
|
|||
func initDBTables() {
|
||||
_, err := db.Exec("DROP TABLE IF EXISTS blocktrees")
|
||||
if err != nil {
|
||||
logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "drop table [blocks] failed: %s", err)
|
||||
logging.LogFatalf(logging.ExitCodeUnavailableDatabase, "drop table [blocks] failed: %s", err)
|
||||
}
|
||||
_, err = db.Exec("CREATE TABLE blocktrees (id, root_id, parent_id, box_id, path, hpath, updated, type)")
|
||||
if err != nil {
|
||||
logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create table [blocktrees] failed: %s", err)
|
||||
logging.LogFatalf(logging.ExitCodeUnavailableDatabase, "create table [blocktrees] failed: %s", err)
|
||||
}
|
||||
|
||||
_, err = db.Exec("CREATE INDEX idx_blocktrees_id ON blocktrees(id)")
|
||||
if err != nil {
|
||||
logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create index [idx_blocktrees_id] failed: %s", err)
|
||||
logging.LogFatalf(logging.ExitCodeUnavailableDatabase, "create index [idx_blocktrees_id] failed: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ func initDBConnection() {
|
|||
var err error
|
||||
db, err = sql.Open("sqlite3_extended", dsn)
|
||||
if err != nil {
|
||||
logging.LogFatalf(logging.ExitCodeReadOnlyDatabase, "create database failed: %s", err)
|
||||
logging.LogFatalf(logging.ExitCodeUnavailableDatabase, "create database failed: %s", err)
|
||||
}
|
||||
db.SetMaxIdleConns(7)
|
||||
db.SetMaxOpenConns(7)
|
||||
|
|
@ -654,7 +654,7 @@ func InitBlockTree(force bool) {
|
|||
err := initDatabase(force)
|
||||
if err != nil {
|
||||
logging.LogErrorf("init database failed: %s", err)
|
||||
os.Exit(logging.ExitCodeReadOnlyDatabase)
|
||||
os.Exit(logging.ExitCodeUnavailableDatabase)
|
||||
return
|
||||
}
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue