自动设置数据库

This commit is contained in:
hoteas 2019-11-10 16:51:27 +08:00
parent fa641b9dcd
commit 7d479f181a
2 changed files with 14 additions and 3 deletions

View File

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="b2aca021-ff30-4cbf-8dc9-8cdd4f4c39dc" name="Default Changelist" comment="" /> <list default="true" id="b2aca021-ff30-4cbf-8dc9-8cdd4f4c39dc" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/dri/db/auto.go" beforeDir="false" afterPath="$PROJECT_DIR$/dri/db/auto.go" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -67,7 +69,7 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1573372557346</updated> <updated>1573372557346</updated>
<workItem from="1573372558521" duration="18000" /> <workItem from="1573372558521" duration="18000" />
<workItem from="1573372583551" duration="3000000" /> <workItem from="1573372583551" duration="3256000" />
</task> </task>
<task id="LOCAL-00001" summary="清理"> <task id="LOCAL-00001" summary="清理">
<created>1573372845218</created> <created>1573372845218</created>
@ -90,7 +92,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1573375369161</updated> <updated>1573375369161</updated>
</task> </task>
<option name="localTasksCounter" value="4" /> <task id="LOCAL-00004" summary="自动设置数据库">
<created>1573375745411</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1573375745411</updated>
</task>
<option name="localTasksCounter" value="5" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">

View File

@ -9,8 +9,10 @@ import (
func SetDB(appIns *hotime.Application) { func SetDB(appIns *hotime.Application) {
if appIns.Config.GetString("dbType") == "sqlite" || strings.Index(appIns.Config.GetString("dbName"), ".db") == len(appIns.Config.GetString("dbName"))-3 { if appIns.Config.GetString("dbType") == "sqlite" || strings.Index(appIns.Config.GetString("dbName"), ".db") == len(appIns.Config.GetString("dbName"))-3 {
appIns.Config["dbType"] = "sqlite"
sqlite.SetDB(appIns) sqlite.SetDB(appIns)
} else { } else {
appIns.Config["dbType"] = "mysql"
mysql.SetDB(appIns) mysql.SetDB(appIns)
} }
} }