feat: mysql 支持编辑表结构、索引

This commit is contained in:
刘宗洋
2022-10-23 17:55:22 +08:00
parent c8f0b0a83f
commit ab42b3e90b
9 changed files with 438 additions and 57 deletions

View File

@@ -357,7 +357,8 @@ func GetDbConn(d *entity.Db, db string) (*sql.DB, error) {
func getDsn(d *entity.Db, db string) string {
var dsn string
if d.Type == entity.DbTypeMysql {
dsn = fmt.Sprintf("%s:%s@%s(%s:%d)/%s?timeout=8s", d.Username, d.Password, d.Network, d.Host, d.Port, db)
// 更多参数参考https://github.com/go-sql-driver/mysql#dsn-data-source-name
dsn = fmt.Sprintf("%s:%s@%s(%s:%d)/%s?timeout=8s&multiStatements=true", d.Username, d.Password, d.Network, d.Host, d.Port, db)
if d.Params != "" {
dsn = fmt.Sprintf("%s&%s", dsn, d.Params)
}