diff --git a/.idea/GOHCache.xml b/.idea/GOHCache.xml index c9c824c..7aee180 100644 --- a/.idea/GOHCache.xml +++ b/.idea/GOHCache.xml @@ -201,7 +201,7 @@ - @@ -342,7 +342,7 @@ - @@ -398,7 +398,7 @@ - diff --git a/database/database.go b/database/database.go index f42db85..5ce41e7 100644 --- a/database/database.go +++ b/database/database.go @@ -68,10 +68,12 @@ func mysqlInit() { } func sqliteInit() { - _, err = gfile.Create(dns.String()) - if err != nil { - log.Error("创建数据库文件失败: ", err) - return + if !gfile.Exists(dns.String()) { + _, err = gfile.Create(dns.String()) + if err != nil { + log.Error("创建数据库文件失败: ", err) + return + } } Type = sqlite.Open(fmt.Sprintf("%s?cache=shared&mode=rwc&_busy_timeout=10000&_fk=1&_journal=WAL&_sync=FULL", dns.String())) }