fix(database): 优化SQLite数据库初始化逻辑
- 在创建数据库文件前先检查文件是否存在 - 避免重复创建已存在的数据库文件 - 更新项目配置文件中的文件修改时间戳main v1.0.00023
parent
258112d38e
commit
60f0d8053d
|
|
@ -201,7 +201,7 @@
|
|||
<entry key="file://$PROJECT_DIR$/database/database.go">
|
||||
<value>
|
||||
<ScannedPath>
|
||||
<option name="lastModified" value="1770100613057" />
|
||||
<option name="lastModified" value="1770258641711" />
|
||||
</ScannedPath>
|
||||
</value>
|
||||
</entry>
|
||||
|
|
@ -342,7 +342,7 @@
|
|||
<entry key="file://$PROJECT_DIR$/valid/valid.go">
|
||||
<value>
|
||||
<ScannedPath>
|
||||
<option name="lastModified" value="1770192971883" />
|
||||
<option name="lastModified" value="1770197737203" />
|
||||
</ScannedPath>
|
||||
</value>
|
||||
</entry>
|
||||
|
|
@ -398,7 +398,7 @@
|
|||
<entry key="file://$PROJECT_DIR$/../gin_test/controller/home/index.go">
|
||||
<value>
|
||||
<ScannedPath>
|
||||
<option name="lastModified" value="1770191170351" />
|
||||
<option name="lastModified" value="1770255253603" />
|
||||
</ScannedPath>
|
||||
</value>
|
||||
</entry>
|
||||
|
|
|
|||
|
|
@ -68,10 +68,12 @@ func mysqlInit() {
|
|||
}
|
||||
|
||||
func sqliteInit() {
|
||||
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()))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue