Skip to content

Commit

Permalink
Update devnonce encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
brocaar committed Dec 11, 2024
1 parent 8191698 commit 2a67468
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ database will be removed!

## Notes

* This utility is compatible with the ChirpStack v4.8.1 database schema.
* This utility is compatible with the ChirpStack v4.10.2 database schema.
* This utility does not support [environment variables](https://www.chirpstack.io/docs/chirpstack/configuration.html#environment-variables) in configuration files, like ChirpStack does.

## Building from source
Expand Down
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1917,13 +1917,20 @@ func migrateDeviceKeysFn(tx *sqlx.Tx, devEUIs [][]byte) {
}
}

devNoncesJSON, err := json.Marshal(map[string][]int64{
"0000000000000000": devNonces,
})
if err != nil {
log.Fatal("Marshal DevNonces error")
}

_, err = stmt.Exec(
dk.DevEUI,
dk.CreatedAt,
dk.UpdatedAt,
dk.NwkKey,
dk.AppKey,
pq.Int64Array(devNonces),
string(devNoncesJSON),
dk.JoinNonce,
)
if err != nil {
Expand Down

0 comments on commit 2a67468

Please sign in to comment.