We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the Bug This is a follow up to issue #563
Despite following the guidlines about how to import drivers from database, I seem to be hitting the same problem with an unknown import error:
database
database driver: unknown driver pgx (forgotten import?)
I've also run the neccesary go get command with the pgx tag go install -tags 'pgx' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
go get
pgx
go install -tags 'pgx' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
"github.com/golang-migrate/migrate/v4" _ "github.com/golang-migrate/migrate/v4/database/pgx/v5" _ "github.com/golang-migrate/migrate/v4/source/file" //more imports ) func main() { ctx := context.Background() port := ":8080" // Define the port as a variable for reuse lis, err := net.Listen("tcp", port) if err != nil { log.Fatalf("Failed to listen: %v", err) } //open db connection connStr := GetDbString() conn, err := pgx.Connect(ctx, connStr) if err != nil { log.Fatalf("Failed to connect to Postgres DB: %v", err) } log.Print("Successfully connected to %f", connStr) defer conn.Close(ctx) queries := db.New(conn) //Create server and register services grpcServer := grpc.NewServer() // Run migrations m, err := migrate.New( "file:///postgres/migrations", "pgx://test_db_user:test_db_password@db:5432/my_test_db") if err != nil { log.Fatalf("Migration creation failed: %v", err) <------ failing here } if err := m.Up(); err != nil { if err != migrate.ErrNoChange { log.Fatalf("Migration failed: %v", err) } } log.Println("Migration completed successfully")
Steps to Reproduce Steps to reproduce the behavior:
Expected Behavior I would expect a succesful migration
Loaded Database Drivers pgx
Go Version go 1.21 linux/amd64
The text was updated successfully, but these errors were encountered:
I did have the same issue... I found that because of --> https://github.com/golang-migrate/migrate/blob/master/database/pgx/v5/pgx.go#L30
You need to use pgx5 in your dsn like this :
m, err := migrate.New( "file:///postgres/migrations", "pgx5://test_db_user:test_db_password@db:5432/my_test_db")
hope it can help you or someone else
Sorry, something went wrong.
No branches or pull requests
Describe the Bug
This is a follow up to issue #563
Despite following the guidlines about how to import drivers from
database
, I seem to be hitting the same problem with an unknown import error:database driver: unknown driver pgx (forgotten import?)
I've also run the neccesary
go get
command with thepgx
taggo install -tags 'pgx' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
Steps to Reproduce
Steps to reproduce the behavior:
Expected Behavior
I would expect a succesful migration
Loaded Database Drivers
pgx
Go Version
go 1.21 linux/amd64
The text was updated successfully, but these errors were encountered: