fix: Modify default values for recommended apps on dashboard (#9375)

This commit is contained in:
ssongliu 2025-07-02 17:41:36 +08:00 committed by GitHub
parent 1767b84026
commit afa643519f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View file

@ -28,6 +28,7 @@ func InitAgentDB() {
migrations.AddSnapshotRule,
migrations.UpdatePHPRuntime,
migrations.AddSnapshotIgnore,
migrations.InitAppLauncher,
})
if err := m.Migrate(); err != nil {
global.LOG.Error(err)

View file

@ -344,3 +344,19 @@ var AddSnapshotIgnore = &gormigrate.Migration{
)
},
}
var InitAppLauncher = &gormigrate.Migration{
ID: "20250702-init-app-launcher",
Migrate: func(tx *gorm.DB) error {
launchers := []string{"openresty", "mysql", "halo", "redis", "maxkb", "wordpress"}
for _, val := range launchers {
var item model.AppLauncher
_ = tx.Model(&model.AppLauncher{}).Where("key = ?", val).First(&item).Error
if item.ID == 0 {
item.Key = val
_ = tx.Create(&item).Error
}
}
return nil
},
}