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 {
return err
}
isOk = true
return nil
}

View File

@ -143,6 +143,15 @@ func (u *MysqlService) LoadFromRemote(from string) error {
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))
if err != nil {
return err
@ -164,6 +173,7 @@ func (u *MysqlService) LoadFromRemote(from string) error {
if err := copier.Copy(&createItem, &data); err != nil {
return errors.WithMessage(constant.ErrStructTransform, err.Error())
}
createItem.MysqlName = mysqlName
if err := mysqlRepo.Create(context.Background(), &createItem); err != nil {
return err
}

View File

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

View File

@ -174,7 +174,7 @@ const message = {
numberRange: 'Number range: {0} - {1}',
paramName: 'Support English, numbers, .- and _, length 2-30',
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)',
nginxDoc: 'Only supports English case, numbers, and .',
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) => {
let params = {
type: 'mysql',
name: mysqlName.value || row.name,
name: row.mysqlName,
detailName: row.name,
};
uploadRef.value!.acceptParams(params);