From 2a6746873ef123edd704c47d185c4ca5874b3718 Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Wed, 11 Dec 2024 09:55:34 +0000 Subject: [PATCH] Update devnonce encoding. --- README.md | 2 +- main.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 63fb402..610ea24 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/main.go b/main.go index f7240bd..c64e845 100644 --- a/main.go +++ b/main.go @@ -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 {