1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-13 17:24:44 +08:00

fix: 解决部分升级失败的问题 (#1624)

This commit is contained in:
ssongliu 2023-07-12 21:11:20 +08:00 committed by GitHub
parent 7dd5082bac
commit ff3b41686c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -437,7 +437,7 @@ var EncryptHostPassword = &gormigrate.Migration{
ID: "20230703-encrypt-host-password",
Migrate: func(tx *gorm.DB) error {
var hosts []model.Host
if err := tx.Find(&hosts).Error; err != nil {
if err := tx.Where("1 = 1").Find(&hosts).Error; err != nil {
return err
}
@ -462,7 +462,7 @@ var EncryptHostPassword = &gormigrate.Migration{
if err != nil {
return err
}
if err := tx.Model(&model.Host{}).Update("private_key", key).Error; err != nil {
if err := tx.Model(&model.Host{}).Where("id = ?", host.ID).Update("private_key", key).Error; err != nil {
return err
}
}
@ -471,7 +471,7 @@ var EncryptHostPassword = &gormigrate.Migration{
if err != nil {
return err
}
if err := tx.Model(&model.Host{}).Update("pass_phrase", pass).Error; err != nil {
if err := tx.Model(&model.Host{}).Where("id = ?", host.ID).Update("pass_phrase", pass).Error; err != nil {
return err
}
}