mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
fix: 解决删除MYSQL应用没有同步删除表数据的BUG
This commit is contained in:
parent
7591a716f4
commit
ed11c0a4a6
@ -19,6 +19,7 @@ type IMysqlRepo interface {
|
|||||||
Delete(ctx context.Context, opts ...DBOption) error
|
Delete(ctx context.Context, opts ...DBOption) error
|
||||||
Update(id uint, vars map[string]interface{}) error
|
Update(id uint, vars map[string]interface{}) error
|
||||||
UpdateDatabaseInfo(id uint, vars map[string]interface{}) error
|
UpdateDatabaseInfo(id uint, vars map[string]interface{}) error
|
||||||
|
DeleteAll(ctx context.Context) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewIMysqlRepo() IMysqlRepo {
|
func NewIMysqlRepo() IMysqlRepo {
|
||||||
@ -65,6 +66,10 @@ func (u *MysqlRepo) Delete(ctx context.Context, opts ...DBOption) error {
|
|||||||
return getTx(ctx, opts...).Delete(&model.DatabaseMysql{}).Error
|
return getTx(ctx, opts...).Delete(&model.DatabaseMysql{}).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *MysqlRepo) DeleteAll(ctx context.Context) error {
|
||||||
|
return getTx(ctx).Where("1 = 1").Delete(&model.DatabaseMysql{}).Error
|
||||||
|
}
|
||||||
|
|
||||||
func (u *MysqlRepo) Update(id uint, vars map[string]interface{}) error {
|
func (u *MysqlRepo) Update(id uint, vars map[string]interface{}) error {
|
||||||
return global.DB.Model(&model.DatabaseMysql{}).Where("id = ?", id).Updates(vars).Error
|
return global.DB.Model(&model.DatabaseMysql{}).Where("id = ?", id).Updates(vars).Error
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,9 @@ func deleteAppInstall(ctx context.Context, install model.AppInstall, deleteBacku
|
|||||||
}
|
}
|
||||||
_ = backupRepo.DeleteRecord(ctx, commonRepo.WithByType("app"), commonRepo.WithByName(install.App.Key), backupRepo.WithByDetailName(install.Name))
|
_ = backupRepo.DeleteRecord(ctx, commonRepo.WithByType("app"), commonRepo.WithByName(install.App.Key), backupRepo.WithByDetailName(install.Name))
|
||||||
_ = backupRepo.DeleteRecord(ctx, commonRepo.WithByType(install.App.Key))
|
_ = backupRepo.DeleteRecord(ctx, commonRepo.WithByType(install.App.Key))
|
||||||
|
if install.App.Key == constant.AppMysql {
|
||||||
|
_ = mysqlRepo.DeleteAll(ctx)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user