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:
nblock
2025-01-30 14:57:06 +01:00
committed by GitHub
parent 7ba6ad3489
commit f44b1d37c4
2 changed files with 10 additions and 0 deletions

View File

@@ -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