Skip to content

Commit 8191698

Browse files
committed
Update to ChirpStack v4.8.1 db scheme.
1 parent 129c86e commit 8191698

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ database will be removed!
4545

4646
## Notes
4747

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

5151
## Building from source

main.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"fmt"
1212
"io/ioutil"
1313
"log"
14+
"math"
1415
"os"
1516
"strconv"
1617
"strings"
@@ -742,7 +743,7 @@ func migrateMulticastGroupsFn() {
742743
"group_type",
743744
"dr",
744745
"frequency",
745-
"class_b_ping_slot_period",
746+
"class_b_ping_slot_nb_k",
746747
"class_c_scheduling_type",
747748
))
748749
if err != nil {
@@ -759,6 +760,11 @@ func migrateMulticastGroupsFn() {
759760

760761
found = true
761762

763+
pingSlotNbK := nsMCGroup.PingSlotPeriod
764+
if pingSlotNbK != 0 {
765+
pingSlotNbK = uint32(math.Log2(float64(pingSlotNbK) / 32.0))
766+
}
767+
762768
_, err = stmt.Exec(
763769
nsMCGroup.ID,
764770
intToUUID(asMCGroup.ApplicationID),
@@ -773,7 +779,7 @@ func migrateMulticastGroupsFn() {
773779
nsMCGroup.GroupType,
774780
nsMCGroup.DR,
775781
nsMCGroup.Frequency,
776-
nsMCGroup.PingSlotPeriod,
782+
pingSlotNbK,
777783
"DELAY",
778784
)
779785
if err != nil {
@@ -1532,6 +1538,7 @@ func migrateDeviceProfilesFn() {
15321538
"relay_global_uplink_limit_bucket_size",
15331539
"relay_overall_limit_bucket_size",
15341540
"allow_roaming",
1541+
"rx1_delay",
15351542
))
15361543
if err != nil {
15371544
log.Fatal("Prepare device-profile statement error", err)
@@ -1625,6 +1632,7 @@ function encodeDownlink(input) {
16251632
0,
16261633
0,
16271634
true,
1635+
0,
16281636
)
16291637
if err != nil {
16301638
log.Fatal("Exec device-profile statement error", err)

0 commit comments

Comments
 (0)