Open
Description
I'm trying to use migrate in conjuction with the new go tool
command (https://tip.golang.org/doc/go1.24#go-command), but not having much luck. I wondered if anyone knows knows a workaround or the right commands to run?
I've tried:
$ go get -tool github.com/golang-migrate/migrate/v4/cmd/migrate@latest
$ go tool migrate -path ./migrations -database postgres://user:pa55word@localhost/db_name up
But this fails with the following error.
error: failed to open database: database driver: unknown driver postgres (forgotten import?)
I tried specifying the build tag postgres
during the go get
, but get the same error.
$ go get -tool -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
$ go tool migrate -path ./migrations -database postgres://user:pa55word@localhost/db_name up
error: failed to open database: database driver: unknown driver postgres (forgotten import?)
In contrast, go run
with the build tag postgres
works as expected:
$ go run -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest -path ./migrations -database postgres://user:pa55word@localhost/db_name
up
no change
Metadata
Metadata
Assignees
Labels
No labels