upgrading to go 1.18 for generics (and lodash-like library).

devices with an empty wwn should be filtered out (not uploaded during device registration, skipped when attempting to upload metrics).
added a migration to delete existing device entries with an empty `wwn`

fixes #314
This commit is contained in:
Jason Kulatunga
2022-07-09 18:28:49 -07:00
parent 30bd18f816
commit 5ea149d878
11 changed files with 51 additions and 19 deletions
@@ -267,6 +267,14 @@ func (sr *scrutinyRepository) Migrate(ctx context.Context) error {
return tx.AutoMigrate(m20220509170100.Device{})
},
},
{
ID: "m20220709181300",
Migrate: func(tx *gorm.DB) error {
// delete devices with empty `wwn` field (they are impossible to delete manually), and are invalid.
return tx.Where("wwn = ?", "").Delete(&models.Device{}).Error
},
},
})
if err := m.Migrate(); err != nil {