Browse Source

fix: 解决创建数据库用户重复的问题 (#1837)

pull/1855/head
ssongliu 1 year ago committed by GitHub
parent
commit
a516ba9d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      backend/utils/mysql/client/local.go
  2. 1
      backend/utils/mysql/client/remote.go

1
backend/utils/mysql/client/local.go

@ -39,6 +39,7 @@ func (r *Local) Create(info CreateInfo) error {
} }
if err := r.CreateUser(info); err != nil { if err := r.CreateUser(info); err != nil {
_ = r.ExecSQL(fmt.Sprintf("drop database if exists `%s`", info.Name), info.Timeout)
return err return err
} }

1
backend/utils/mysql/client/remote.go

@ -40,6 +40,7 @@ func (r *Remote) Create(info CreateInfo) error {
} }
if err := r.CreateUser(info); err != nil { if err := r.CreateUser(info); err != nil {
_ = r.ExecSQL(fmt.Sprintf("drop database if exists `%s`", info.Name), info.Timeout)
return err return err
} }

Loading…
Cancel
Save