mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-27 12:39:01 +08:00
parent
65fb2bd401
commit
98e73395fc
@ -196,6 +196,9 @@ func (u *MysqlService) LoadFromRemote(req dto.MysqlLoadDB) error {
|
||||
for i := 0; i < len(databases); i++ {
|
||||
if strings.EqualFold(databases[i].Name, data.Name) && strings.EqualFold(databases[i].MysqlName, data.MysqlName) {
|
||||
hasOld = true
|
||||
if databases[i].IsDelete {
|
||||
_ = mysqlRepo.Update(databases[i].ID, map[string]interface{}{"is_delete": false})
|
||||
}
|
||||
deleteList = append(deleteList[:i], deleteList[i+1:]...)
|
||||
break
|
||||
}
|
||||
|
@ -222,6 +222,9 @@ func (u *PostgresqlService) LoadFromRemote(database string) error {
|
||||
for i := 0; i < len(databases); i++ {
|
||||
if strings.EqualFold(databases[i].Name, data.Name) && strings.EqualFold(databases[i].PostgresqlName, data.PostgresqlName) {
|
||||
hasOld = true
|
||||
if databases[i].IsDelete {
|
||||
_ = postgresqlRepo.Update(databases[i].ID, map[string]interface{}{"is_delete": false})
|
||||
}
|
||||
deleteList = append(deleteList[:i], deleteList[i+1:]...)
|
||||
break
|
||||
}
|
||||
|
@ -300,7 +300,10 @@ func (r *Local) SyncDB(version string) ([]SyncDBInfo, error) {
|
||||
}
|
||||
userLines, err := r.ExecSQLForRows(fmt.Sprintf("select user,host from mysql.db where db = '%s'", parts[0]), 300)
|
||||
if err != nil {
|
||||
return datas, err
|
||||
global.LOG.Debugf("sync user of db %s failed, err: %v", parts[0], err)
|
||||
dataItem.Permission = "%"
|
||||
datas = append(datas, dataItem)
|
||||
continue
|
||||
}
|
||||
|
||||
var permissionItem []string
|
||||
|
@ -332,7 +332,10 @@ func (r *Remote) SyncDB(version string) ([]SyncDBInfo, error) {
|
||||
}
|
||||
userRows, err := r.Client.Query("select user,host from mysql.db where db = ?", dbName)
|
||||
if err != nil {
|
||||
return datas, err
|
||||
global.LOG.Debugf("sync user of db %s failed, err: %v", dbName, err)
|
||||
dataItem.Permission = "%"
|
||||
datas = append(datas, dataItem)
|
||||
continue
|
||||
}
|
||||
|
||||
var permissionItem []string
|
||||
|
Loading…
Reference in New Issue
Block a user