mirror of
https://github.com/juanfont/headscale.git
synced 2025-08-11 15:37:37 +00: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:
@@ -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
|
||||
|
Reference in New Issue
Block a user