Skip to content

Commit

Permalink
fix postgres migration
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
  • Loading branch information
kradalby committed Mar 1, 2024
1 parent 7a920ee commit 5c9b286
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hscontrol/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,14 @@ func NewHeadscaleDatabase(
// no longer used.
ID: "202402151347",
Migrate: func(tx *gorm.DB) error {
return tx.Migrator().DropColumn(&types.Node{}, "last_successful_update")
err := tx.Migrator().DropColumn(&types.Node{}, "last_successful_update")
if err != nil && strings.Contains(err.Error(), `of relation "nodes" does not exist`) {
return nil
} else {
return err
}

return err
},
Rollback: func(tx *gorm.DB) error {
return nil
Expand Down

0 comments on commit 5c9b286

Please sign in to comment.