fix: use trap dictionary gorm column names

This commit is contained in:
zxr
2026-07-21 16:45:19 +08:00
parent fdcb96791f
commit e27eef4c84

View File

@@ -231,7 +231,7 @@ func seedDefaultTrapDictionary(db *gorm.DB) error {
} }
for _, row := range rows { for _, row := range rows {
var existing TrapDictionaryEntry var existing TrapDictionaryEntry
err := db.Where("oid_prefix = ?", row.OIDPrefix).First(&existing).Error err := db.Where("o_id_prefix = ?", row.OIDPrefix).First(&existing).Error
if errors.Is(err, gorm.ErrRecordNotFound) { if errors.Is(err, gorm.ErrRecordNotFound) {
if err := db.Create(&row).Error; err != nil { if err := db.Create(&row).Error; err != nil {
return err return err
@@ -242,7 +242,7 @@ func seedDefaultTrapDictionary(db *gorm.DB) error {
return err return err
} }
if err := db.Model(&existing).Omit("updated_at").Select( if err := db.Model(&existing).Omit("updated_at").Select(
"oid_prefix", "o_id_prefix",
"vendor", "vendor",
"o_id", "o_id",
"name", "name",