From fa06062cdcbae50b019af22209733868550ca21a Mon Sep 17 00:00:00 2001 From: R0masik Date: Tue, 4 Feb 2025 04:44:39 +0300 Subject: [PATCH] fix: return joined err when try to get migrations list (#862) --- migrate.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/migrate.go b/migrate.go index 22769ff..32c9e81 100644 --- a/migrate.go +++ b/migrate.go @@ -5,6 +5,7 @@ import ( "database/sql" "errors" "fmt" + "go.uber.org/multierr" "io/fs" "math" "path" @@ -213,7 +214,11 @@ func EnsureDBVersion(db *sql.DB) (int64, error) { func EnsureDBVersionContext(ctx context.Context, db *sql.DB) (int64, error) { dbMigrations, err := store.ListMigrations(ctx, db, TableName()) if err != nil { - return 0, createVersionTable(ctx, db) + createErr := createVersionTable(ctx, db) + if createErr != nil { + return 0, multierr.Append(err, createErr) + } + return 0, nil } // The most recent record for each migration specifies // whether it has been applied or rolled back.