Skip to content

Commit b999baf

Browse files
committed
tapdb: check migrate.Version error
Add checking of the error returned by the `migrate.Version` function in `tapdb/migrations.go`.
1 parent 0ddb086 commit b999baf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tapdb/migrations.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ func applyMigrations(fs fs.FS, driver database.Driver, path, dbName string,
166166
return err
167167
}
168168

169-
migrationVersion, _, _ := sqlMigrate.Version()
169+
migrationVersion, _, err := sqlMigrate.Version()
170+
if err != nil && !errors.Is(err, migrate.ErrNilVersion) {
171+
return fmt.Errorf("unable to determine current migration"+
172+
"version: %w", err)
173+
}
170174

171175
// As the down migrations may end up *dropping* data, we want to
172176
// prevent that without explicit accounting.

0 commit comments

Comments
 (0)