mirror of
https://github.com/juanfont/headscale.git
synced 2025-02-01 07:11:23 +09: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
46b82269e0
commit
341a3d3005
2 changed files with 10 additions and 0 deletions
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
- Fix issue where email and username being equal fails to match in Policy
|
- Fix issue where email and username being equal fails to match in Policy
|
||||||
[#2388](https://github.com/juanfont/headscale/pull/2388)
|
[#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)
|
## 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{})
|
err := tx.AutoMigrate(&types.Route{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue