[PR #2262] fix: save peer status correctly in sqlstore #3335

Open
opened 2025-11-20 08:05:42 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/netbirdio/netbird/pull/2262

State: closed
Merged: Yes


Describe your changes

This change fixes an inconsistency between the value of the boolean fields in the peer status struct, and those same values in the db table.

The problem should be in how the fields get updated in the SavePeerStatus function in the management/server/sql_store.go file, particularly because of how GORM manages the update itself. There's an explanation on the GORM documentation on why this happens.

This could be an issue for other boolean fields updates as well.

https://github.com/netbirdio/netbird/issues/2110

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/2262 **State:** closed **Merged:** Yes --- ## Describe your changes This change fixes an inconsistency between the value of the boolean fields in the peer status struct, and those same values in the db table. The problem should be in how the fields get updated in the `SavePeerStatus` function in the `management/server/sql_store.go` file, particularly because of how GORM manages the update itself. There's an [explanation on the GORM documentation](https://gorm.io/docs/update.html#Updates-multiple-columns) on why this happens. This could be an issue for other boolean fields updates as well. ## Issue ticket number and link https://github.com/netbirdio/netbird/issues/2110 ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary
saavagebueno added the pull-request label 2025-11-20 08:05:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#3335