Open marcesher opened 3 years ago
You'll need to use go install -tags 'pgx' github.com/golang-migrate/migrate/v4/cmd/migrate@master
since the latest release doesn't support pgx yet
When do we think this will be added to the new release?
Any fix this? I stll don't know if I should be using pgx://
. I'm still getting Migration creation failed: database driver: unknown driver pgx (forgotten import?)
My imports are here:
"github.com/golang-migrate/migrate/v4"
_ "github.com/golang-migrate/migrate/v4/database/pgx/v5"
_ "github.com/golang-migrate/migrate/v4/source/file"
"github.com/jackc/pgx/v5"
curious about this as well.
Describe the Bug I am trying to follow the documentation to use go-migrate with
pgx
and I'm having trouble. I'm not sure if I'm reading the docs incorrectly, if there's a documentation bug, an actual bug, or something else.Steps to Reproduce Steps to reproduce the behavior:
tag
to install is the name of the database being used indatabases
. I infer from this that if I'm using pgx, then I should usego install -tags 'pgx' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
pgx://
So I ran
go install -tags 'pgx' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
, and then when I runmigrate
in thedrivers
output it just showsstub
When I try running a migration against a DB connect string prefixed with
pgx
it says that the pgx driver isn't installedI then tried
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
, then used apostgres://
connect string, and it errored with an SSL error, and it is clearly trying to usepq
I then suffixed the connect string with
?sslmode=disable
And the migrations worked.
Now, with using
postgres
andsslmode=disable
I'm not sure if it's an actual problem that my app is usingpgx
but migrations are usingpostgres
. I've only tried simple migrations to date, nothing that uses anything postgres-specific such as JSON fields.Expected Behavior Based on the docs, I'd expect to use
go install -tags 'pgx'...
and a connect string withpgx
Migrate Version
dev
Loaded Source Drivers e.g. s3, github, go-bindata, gcs, file Obtained by running:
migrate -help
Loaded Database Drivers
file
Go Version
go version go1.16.3 linux/amd64
Stacktrace None
Thanks for any help!