refactor🎨: 修改sqplite的支持

This commit is contained in:
wenjianzhang committed 2022-01-22 19:37:56 +08:00
1 parent ae8e32d806
commit 0b73bd7b25
5 files changed
+330 -325

No files matched your search

+10 -2
View File
@@ -11,10 +11,18 @@ import (
func InitDb(db *gorm.DB) (err error) {
filePath := "config/db.sql"
err = ExecSql(db, filePath)
if global.Driver == "postgres" {
filePath = "config/pg.sql"
err = ExecSql(db, filePath)
} else if global.Driver == "mysql" {
filePath = "config/db-begin-mysql.sql"
err = ExecSql(db, filePath)
filePath = "config/db.sql"
err = ExecSql(db, filePath)
filePath = "config/db-end-mysql.sql"
err = ExecSql(db, filePath)
} else {
err = ExecSql(db, filePath)
}
return err
}
@@ -52,4 +60,4 @@ func Ioutil(filePath string) (string, error) {
} else {
return "", err
}
}
}