File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -69,12 +69,18 @@ func (db Database) migrateNodes() error {
69
69
interfaces = append (interfaces , newInterface )
70
70
}
71
71
72
- // Update only the interfaces field
73
- if err := tx .Model (& Node {}).
74
- Where ("node_id = ?" , node .NodeID ).
75
- Update ("interfaces" , interfaces ).Error ; err != nil {
76
- return err // This will roll back the entire transaction
72
+ // skip the node if it has no interfaces
73
+ if len (interfaces ) != 0 {
74
+ // Update only the interfaces field
75
+ if err := tx .Model (& Node {}).
76
+ Where ("node_id = ?" , node .NodeID ).
77
+ Update ("interfaces" , interfaces ).Error ; err != nil {
78
+ return err // This will roll back the entire transaction
79
+ }
80
+
81
+ log .Info ().Uint64 ("node_id" , node .NodeID ).Msg ("Migration: updating node" )
77
82
}
83
+
78
84
}
79
85
80
86
return nil
You can’t perform that action at this time.
0 commit comments