Closed henvic closed 1 year ago
This is a big issue for project using stdlib, I am getting an error "panic: sql: Register called twice for driver pgx" because obviously I cannot use stdlib/v4 and stdlib/v5 in a single binary. Unfortunately, we are still on the sqlx extension and we have to use:
wrapErr := stdConn.Raw(func(pgxConn interface{}) error {
conn := pgxConn.(*stdlib.Conn).Conn()
opts := migrate.MigratorOptions{
MigratorFS: NewEmbeddedFS(&embeddedMigrations),
}
table := fmt.Sprintf("%s.schema_version", schema)
migrator, err := migrate.NewMigratorEx(ctx, conn, table, &opts)
Many thanks! Appreciate the great work you do for the pgx community.
You can use the v2-dev branch for pgx v5 compatibility.
I don't anticipate any significant changes before the v2 release, but I want review the tern interface once more before a release. It may be a little while before I get to it though.
For googlers: Unfortunately, it is not possible to work with branches in Go modules directly, go get github.com/jackc/tern@v2-dev
will install the stuff but you cannot use it until there is an actual release. In case you need this NOW, feel free to add this to your go.mod
file:
// REMOVED read on in the thread
//replace github.com/jackc/tern => github.com/lzap/tern2 main
Ping me on github if you need me to push into the main
branch when there is new work. There are no changes, it's just a clone of the v2-dev
branch from @jackc. My account is safe, I do use 2FA. Or make your own fork or local copy of the branch.
I just pinned this issue to the top so it gets more attention and tagged v2.0.0-beta.1
to make it easier for people to test. Sorry, I hadn't realized that using code from a branch was inconvenient.
As mentioned above, there aren't any planned changes before final release, but more testing and feedback would be great.
Thanks, there is one more little detail which prevents us from using the tag and that is: https://github.com/jackc/tern/pull/69
Other than that, I believe it should work.
Just tagged v2.0.0-beta.2
with the import path fixes.
Thanks.
Googlers: to try the new v2 beta version, do this:
go mod tidy
go get github.com/jackc/tern/v2@v2.0.0-beta.2
And you are all set!
tern
seems to be working like before. :+1:
(I have more problems with pgx 5 around Time
so I can't update yet, but still wanted to report back.)
I really like the API changes around LoadMigrations using a FS, before I had to create my own "migration filesystem".
Finally released v2.0.0
. No significant changes since v2.0.0-beta.3
@jackc 🙏 new release tag with this commit https://github.com/jackc/tern/commit/e066eba9096a9c22436fc495194ad2712aaa2dd0
@meshenka Just release v2.2.0.
Hi @jackc,
Any plans on releasing a new version soon? Thanks!
btw, I've tested it on my project (using the API rather than the CLI), and it worked fine!