mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-10 23:47:39 +08:00
fix: Resolve the issue of database uninstallation failure (#9361)
This commit is contained in:
parent
7a45548387
commit
c522295c56
2 changed files with 25 additions and 17 deletions
|
@ -631,10 +631,14 @@ func (a *AppInstallService) DeleteCheck(installID uint) ([]dto.AppResource, erro
|
||||||
resources, _ := appInstallResourceRepo.GetBy(appInstallResourceRepo.WithLinkId(appInstall.ID), repo.WithByFrom(constant.AppResourceLocal))
|
resources, _ := appInstallResourceRepo.GetBy(appInstallResourceRepo.WithLinkId(appInstall.ID), repo.WithByFrom(constant.AppResourceLocal))
|
||||||
for _, resource := range resources {
|
for _, resource := range resources {
|
||||||
linkInstall, _ := appInstallRepo.GetFirst(repo.WithByID(resource.AppInstallId))
|
linkInstall, _ := appInstallRepo.GetFirst(repo.WithByID(resource.AppInstallId))
|
||||||
|
if linkInstall.ID > 0 {
|
||||||
res = append(res, dto.AppResource{
|
res = append(res, dto.AppResource{
|
||||||
Type: "app",
|
Type: "app",
|
||||||
Name: linkInstall.Name,
|
Name: linkInstall.Name,
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
_ = appInstallResourceRepo.DeleteBy(context.Background(), appInstallResourceRepo.WithAppInstallId(resource.AppInstallId))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,7 +379,8 @@ func deleteAppInstall(deleteReq request.AppInstallDelete) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
resources, _ := appInstallResourceRepo.GetBy(appInstallResourceRepo.WithAppInstallId(install.ID))
|
resources, _ := appInstallResourceRepo.GetBy(appInstallResourceRepo.WithAppInstallId(install.ID))
|
||||||
if deleteReq.DeleteDB && len(resources) > 0 {
|
if len(resources) > 0 {
|
||||||
|
if deleteReq.DeleteDB {
|
||||||
del := dto.DelAppLink{
|
del := dto.DelAppLink{
|
||||||
Ctx: ctx,
|
Ctx: ctx,
|
||||||
Install: &install,
|
Install: &install,
|
||||||
|
@ -394,6 +395,9 @@ func deleteAppInstall(deleteReq request.AppInstallDelete) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.LogSuccessWithOps(task.TaskDelete, i18n.GetMsgByKey("Database"))
|
t.LogSuccessWithOps(task.TaskDelete, i18n.GetMsgByKey("Database"))
|
||||||
|
} else {
|
||||||
|
_ = appInstallResourceRepo.DeleteBy(ctx, appInstallResourceRepo.WithAppInstallId(install.ID))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if DatabaseKeys[install.App.Key] > 0 {
|
if DatabaseKeys[install.App.Key] > 0 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue