rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.23k stars 280 forks source link

Consider moving from packr to pkger #168

Closed jufemaiz closed 4 years ago

jufemaiz commented 4 years ago

At the moment packr/v2 (https://github.com/gobuffalo/packr/tree/master/v2) is recommending people move to use http://github.com/markbates/pkger.

Perhaps this could be explored?

rubenv commented 4 years ago

Note that there isn't any packr dependency in sql-migrate, we just have a minimal interface that mimics the type, to avoid the run-time dependency.

I'm happy to accept a PR that adds a PkgrMigrationSource.

rubenv commented 4 years ago

But obviously, in the interest of backwards compatibility, we can't remove the PackrMigrationSource. Not a problem though, as it's just a small wrapper: https://github.com/rubenv/sql-migrate/blob/64f95ea68aa39b024c83a7d0d60910dbdafcfb04/migrate.go#L334-L389

Shouldn't be hard to build the same thing for pkger.

jufemaiz commented 4 years ago

Sorry for the delayed response @rubenv (and thanks for a great package!). A little more investigation revealed that you've essentially already got the support able to be achieved (thanks in part to your solution, and the new pkger approach being adopted).

migDir := pkger.Dir("/db/migrations/")

migrations := &migrate.HttpFileSystemMigrationSource{
    FileSystem: migDir,
}

migrate.SetTable("migrations")
migrate.Exec(db, "postgres", migrations, migrate.Up)
rubenv commented 4 years ago

Ah that's great to hear.

Perhaps we should add a small section to the README?

On Sun, Apr 5, 2020, 13:59 Joel Courtney notifications@github.com wrote:

Sorry for the delayed response @rubenv https://github.com/rubenv (and thanks for a great package!). A little more investigation revealed that you've essentially already got the support able to be achieved (thanks in part to your solution, and the new pkger approach being adopted).

migDir := pkger.Dir("/db/migrations/") migrations := &migrate.HttpFileSystemMigrationSource{ FileSystem: migDir, }

migrate.SetTable("migrations") migrate.Exec(db, "postgres", migrations, migrate.Up)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rubenv/sql-migrate/issues/168#issuecomment-609404842, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAKPGFJBRXYGFEK3SYKRYDRLBXCHANCNFSM4LQA5JMA .