From c9966ba6c2d88da51da55aa451d09c7c23740500 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 1 Mar 2024 19:11:46 +0100 Subject: [PATCH] fix postgres migration (#1802) --- hscontrol/db/db.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hscontrol/db/db.go b/hscontrol/db/db.go index bcd07e47..870ad599 100644 --- a/hscontrol/db/db.go +++ b/hscontrol/db/db.go @@ -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