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
2 changed files with 10 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue