Skip to content

Commit

Permalink
Update to ChirpStack v4.4.0 db schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
brocaar committed Jun 27, 2023
1 parent 070d1ef commit 4850f1a
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ will drop all tenants and users from the ChirpStack v4 database.

## Notes

* This utilty is compatible with the ChirpStack v4.2.0 or later database schema.
* This utilty is compatible with the ChirpStack v4.4.0 or later database schema.
* This utilty 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
59 changes: 55 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1004,8 +1004,35 @@ function encodeDownlink(input) {
flush_queue_on_activate,
measurements,
auto_detect_measurements,
region_config_id
) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31)`,
region_config_id,
is_relay,
is_relay_ed,
relay_ed_relay_only,
relay_enabled,
relay_cad_periodicity,
relay_default_channel_index,
relay_second_channel_freq,
relay_second_channel_dr,
relay_second_channel_ack_offset,
relay_ed_activation_mode,
relay_ed_smart_enable_level,
relay_ed_back_off,
relay_ed_uplink_limit_bucket_size,
relay_ed_uplink_limit_reload_rate,
relay_join_req_limit_reload_rate,
relay_notify_limit_reload_rate,
relay_global_uplink_limit_reload_rate,
relay_overall_limit_reload_rate,
relay_join_req_limit_bucket_size,
relay_notify_limit_bucket_size,
relay_global_uplink_limit_bucket_size,
relay_overall_limit_bucket_size
) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,
$11, $12, $13, $14, $15, $16, $17, $18, $19, $20,
$21, $22, $23, $24, $25, $26, $27, $28, $29, $30,
$31, $32, $33, $34, $35, $36, $37, $38, $39, $40,
$41, $42, $43, $44, $45, $46, $47, $48, $49, $50,
$51, $52, $53)`,
nsDP.ID,
intToUUID(asDP.OrganizationID),
asDP.CreatedAt,
Expand Down Expand Up @@ -1037,6 +1064,28 @@ function encodeDownlink(input) {
"{}",
true,
nil,
false,
false,
false,
false,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
)
if err != nil {
panic(err)
Expand Down Expand Up @@ -1124,8 +1173,9 @@ func migrateDevices() {
skip_fcnt_check,
is_disabled,
tags,
variables
) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22)`,
variables,
join_eui
) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23)`,
dev.DevEUI,
intToUUID(asDEV.ApplicationID),
asDEV.DeviceProfileID,
Expand All @@ -1148,6 +1198,7 @@ func migrateDevices() {
dev.IsDisabled,
hstoreToJSON(asDEV.Tags),
hstoreToJSON(asDEV.Variables),
[]byte{0, 0, 0, 0, 0, 0, 0, 0},
)
if err != nil {
panic(err)
Expand Down

0 comments on commit 4850f1a

Please sign in to comment.