Skip to content
This repository was archived by the owner on May 2, 2025. It is now read-only.

Commit 4cf51cc

Browse files
committed
Use mac on empty gw name / description (gwmigrate).
This code exists to migrate the gateway info (name and description) from LoRa Server. The name and description fields will be removed in a future version of LoRa Server.
1 parent b3ba0bb commit 4cf51cc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/storage/gwmigrate/gwmigrate.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ func MigrateGateways(ctx common.Context) error {
5454
for _, gw := range gwRes.Result {
5555
var mac lorawan.EUI64
5656
copy(mac[:], gw.Mac)
57+
58+
if gw.Name == "" {
59+
gw.Name = mac.String()
60+
}
61+
62+
if gw.Description == "" {
63+
gw.Description = mac.String()
64+
}
65+
5766
err = storage.CreateGateway(ctx.DB, &storage.Gateway{
5867
MAC: mac,
5968
Name: gw.Name,

0 commit comments

Comments
 (0)