jackc / tern

The SQL Fan's Migrator
MIT License
1k stars 71 forks source link

New release with version using pgx v5? #66

Closed henvic closed 1 year ago

henvic commented 2 years ago

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!

lzap commented 2 years 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.

jackc commented 2 years ago

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.

lzap commented 2 years ago

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.

jackc commented 2 years ago

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.

lzap commented 2 years ago

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.

jackc commented 2 years ago

Just tagged v2.0.0-beta.2 with the import path fixes.

lzap commented 2 years ago

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!

BuJo commented 1 year ago

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".

jackc commented 1 year ago

Finally released v2.0.0. No significant changes since v2.0.0-beta.3

meshenka commented 7 months ago

@jackc 🙏 new release tag with this commit https://github.com/jackc/tern/commit/e066eba9096a9c22436fc495194ad2712aaa2dd0

jackc commented 6 months ago

@meshenka Just release v2.2.0.