mirror of https://github.com/1Panel-dev/1Panel
fix: 解决删除 mariadb 的时候没有删除数据库表信息的问题 (#2219)
parent
a61487de9f
commit
f812d9f7cd
|
@ -277,8 +277,9 @@ func deleteAppInstall(install model.AppInstall, deleteBackup bool, forceDelete b
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteLink(ctx context.Context, install *model.AppInstall, deleteDB bool, forceDelete bool) error {
|
func deleteLink(ctx context.Context, install *model.AppInstall, deleteDB bool, forceDelete bool) error {
|
||||||
if install.App.Key == "mysql" || install.App.Key == "mariadb" {
|
if DatabaseKeys[install.App.Key] {
|
||||||
_ = databaseRepo.Delete(ctx, databaseRepo.WithAppInstallID(install.ID))
|
_ = databaseRepo.Delete(ctx, databaseRepo.WithAppInstallID(install.ID))
|
||||||
|
_ = mysqlRepo.Delete(ctx, mysqlRepo.WithByMysqlName(install.Name))
|
||||||
}
|
}
|
||||||
resources, _ := appInstallResourceRepo.GetBy(appInstallResourceRepo.WithAppInstallId(install.ID))
|
resources, _ := appInstallResourceRepo.GetBy(appInstallResourceRepo.WithAppInstallId(install.ID))
|
||||||
if len(resources) == 0 {
|
if len(resources) == 0 {
|
||||||
|
@ -286,7 +287,7 @@ func deleteLink(ctx context.Context, install *model.AppInstall, deleteDB bool, f
|
||||||
}
|
}
|
||||||
for _, re := range resources {
|
for _, re := range resources {
|
||||||
mysqlService := NewIMysqlService()
|
mysqlService := NewIMysqlService()
|
||||||
if re.Key == "mysql" || re.Key == "mariadb" && deleteDB {
|
if (re.Key == "mysql" || re.Key == "mariadb") && deleteDB {
|
||||||
database, _ := mysqlRepo.Get(commonRepo.WithByID(re.ResourceId))
|
database, _ := mysqlRepo.Get(commonRepo.WithByID(re.ResourceId))
|
||||||
if reflect.DeepEqual(database, model.DatabaseMysql{}) {
|
if reflect.DeepEqual(database, model.DatabaseMysql{}) {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue