Explorar o código

feat:兼容数据库类型大小写

lifei6671 %!s(int64=7) %!d(string=hai) anos
pai
achega
b50d39f690
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      commands/command.go

+ 2 - 2
commands/command.go

@@ -32,7 +32,7 @@ func RegisterDataBase() {
 	beego.Info("正在初始化数据库配置.")
 	adapter := beego.AppConfig.String("db_adapter")
 
-	if adapter == "mysql" {
+	if strings.EqualFold(adapter, "mysql") {
 		host := beego.AppConfig.String("db_host")
 		database := beego.AppConfig.String("db_database")
 		username := beego.AppConfig.String("db_username")
@@ -54,7 +54,7 @@ func RegisterDataBase() {
 			beego.Error("注册默认数据库失败->", err)
 			os.Exit(1)
 		}
-	} else if adapter == "sqlite3" {
+	} else if strings.EqualFold(adapter, "sqlite3") {
 		orm.DefaultTimeLoc = time.UTC
 		database := beego.AppConfig.String("db_database")
 		if strings.HasPrefix(database, "./") {