mirror of
https://github.com/juanfont/headscale.git
synced 2025-02-06 00:19:25 +01:00
Remove routes without a node_id (#2386)
The routes table has a NOT NULL constraint on node_id. Fixes: #2376
This commit is contained in:
parent
7ba6ad3489
commit
f44b1d37c4
@ -13,6 +13,8 @@
|
||||
|
||||
- Fix issue where email and username being equal fails to match in Policy
|
||||
[#2388](https://github.com/juanfont/headscale/pull/2388)
|
||||
- Delete invalid routes before adding a NOT NULL constraint on node_id
|
||||
[#2386](https://github.com/juanfont/headscale/pull/2386)
|
||||
|
||||
## 0.24.1 (2025-01-23)
|
||||
|
||||
|
@ -565,6 +565,14 @@ COMMIT;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any invalid routes without a node_id.
|
||||
if tx.Migrator().HasTable(&types.Route{}) {
|
||||
err := tx.Exec("delete from routes where node_id is null").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
err := tx.AutoMigrate(&types.Route{})
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user