自动设置数据库

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"?>
<project version="4">
<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="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -67,7 +69,7 @@
<option name="presentableId" value="Default" />
<updated>1573372557346</updated>
<workItem from="1573372558521" duration="18000" />
<workItem from="1573372583551" duration="3000000" />
<workItem from="1573372583551" duration="3256000" />
</task>
<task id="LOCAL-00001" summary="清理">
<created>1573372845218</created>
@ -90,7 +92,14 @@
<option name="project" value="LOCAL" />
<updated>1573375369161</updated>
</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 />
</component>
<component name="TypeScriptGeneratedFilesManager">

View File

@ -9,8 +9,10 @@ import (
func SetDB(appIns *hotime.Application) {
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)
} else {
appIns.Config["dbType"] = "mysql"
mysql.SetDB(appIns)
}
}