Forráskód Böngészése

add migration for extclient tags

abhishek9686 5 hónapja
szülő
commit
75307cb726
2 módosított fájl, 10 hozzáadás és 1 törlés
  1. 7 0
      migrate/migrate.go
  2. 3 1
      models/extclient.go

+ 7 - 0
migrate/migrate.go

@@ -227,6 +227,13 @@ func updateNodes() {
 			}
 		}
 	}
+	extclients, _ := logic.GetAllExtClients()
+	for _, extclient := range extclients {
+		if extclient.Tags == nil {
+			extclient.Tags = make(map[models.TagID]struct{})
+			logic.SaveExtClient(&extclient)
+		}
+	}
 }
 
 func removeInterGw(egressRanges []string) ([]string, bool) {

+ 3 - 1
models/extclient.go

@@ -50,7 +50,9 @@ type CustomExtClient struct {
 }
 
 func (ext *ExtClient) ConvertToStaticNode() Node {
-
+	if ext.Tags == nil {
+		ext.Tags = make(map[TagID]struct{})
+	}
 	return Node{
 		CommonNode: CommonNode{
 			Network: ext.Network,