fix: 解决数据库同步后备份路径错误的问题 (#1830)

This commit is contained in:
ssongliu 2023-08-04 14:10:43 +08:00 committed by GitHub
parent d4e6232664
commit 80e845f320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 6 deletions

View File

@ -176,5 +176,6 @@ func handleMysqlRecover(req dto.CommonRecover, isRollback bool) error {
}); err != nil { }); err != nil {
return err return err
} }
isOk = true
return nil return nil
} }

View File

@ -143,6 +143,15 @@ func (u *MysqlService) LoadFromRemote(from string) error {
return err return err
} }
mysqlName := from
if from == "local" {
app, err := appInstallRepo.LoadBaseInfo("mysql", "")
if err != nil {
return err
}
mysqlName = app.Name
}
databases, err := mysqlRepo.List(remoteDBRepo.WithByFrom(from)) databases, err := mysqlRepo.List(remoteDBRepo.WithByFrom(from))
if err != nil { if err != nil {
return err return err
@ -164,6 +173,7 @@ func (u *MysqlService) LoadFromRemote(from string) error {
if err := copier.Copy(&createItem, &data); err != nil { if err := copier.Copy(&createItem, &data); err != nil {
return errors.WithMessage(constant.ErrStructTransform, err.Error()) return errors.WithMessage(constant.ErrStructTransform, err.Error())
} }
createItem.MysqlName = mysqlName
if err := mysqlRepo.Create(context.Background(), &createItem); err != nil { if err := mysqlRepo.Create(context.Background(), &createItem); err != nil {
return err return err
} }

View File

@ -270,10 +270,9 @@ func (r *Local) SyncDB(version string) ([]SyncDBInfo, error) {
continue continue
} }
dataItem := SyncDBInfo{ dataItem := SyncDBInfo{
Name: parts[0], Name: parts[0],
From: r.From, From: r.From,
MysqlName: r.From, Format: parts[1],
Format: parts[1],
} }
userLines, err := r.ExecSQLForRows(fmt.Sprintf("SELECT USER,HOST FROM mysql.DB WHERE DB = '%s'", parts[0]), 300) userLines, err := r.ExecSQLForRows(fmt.Sprintf("SELECT USER,HOST FROM mysql.DB WHERE DB = '%s'", parts[0]), 300)
if err != nil { if err != nil {

View File

@ -174,7 +174,7 @@ const message = {
numberRange: 'Number range: {0} - {1}', numberRange: 'Number range: {0} - {1}',
paramName: 'Support English, numbers, .- and _, length 2-30', paramName: 'Support English, numbers, .- and _, length 2-30',
paramComplexity: paramComplexity:
'Support English, numbers, {0}, length 6-30,Special characters cannot be at the beginning and end', 'Support English, numbers, {0}, length 6-128,Special characters cannot be at the beginning and end',
paramUrlAndPort: 'The format is http(s)://(domain name/ip):(port)', paramUrlAndPort: 'The format is http(s)://(domain name/ip):(port)',
nginxDoc: 'Only supports English case, numbers, and .', nginxDoc: 'Only supports English case, numbers, and .',
appName: 'Support English, numbers, - and _, length 2-30, and cannot start and end with -_', appName: 'Support English, numbers, - and _, length 2-30, and cannot start and end with -_',

View File

@ -464,7 +464,7 @@ const buttons = [
click: (row: Database.MysqlDBInfo) => { click: (row: Database.MysqlDBInfo) => {
let params = { let params = {
type: 'mysql', type: 'mysql',
name: mysqlName.value || row.name, name: row.mysqlName,
detailName: row.name, detailName: row.name,
}; };
uploadRef.value!.acceptParams(params); uploadRef.value!.acceptParams(params);