dbmate
dbmate copied to clipboard
Support go1.16 io/fs.FS concept for file embedding
Hi there, it would be cool if the dbmate.DB type supported an FS field, so it can be used with go 1.16 file embedding. My use case is that I want to embed dbmate into my go program, and also embed the migrations using the //go:embed
directive so I don't have to ship the files separately.
I will gladly make a PR that adds this feature.
Hi - I haven't used go embedding yet, but if you can make a PR and do this in a way that is not too invasive I'm happy to look at it.
+1 I would also like to bake in my migrations using embed. It would also be great if the documentation had a quick example of using this project as an included module.
Hi ! I'm also looking to embed migrations in my binary.
@bouk can you expand about what is blocking the PR ? Go 1.16 is out for a while now so I guess we don't need to support previous versions. Golang-migrate also included this feature recently.
Thanks!
@amacneil Are you open to accept a PR to support this feature?
I've done some experiments here: https://github.com/Enrico204/dbmate/commit/7571bc6e5f5218601a8ca93e15977f4a6021c288
I'm using that code in production projects to apply migrations. Migrations are embedded using the standard go:embed
directive.
@amacneil if you're interested, I can rebase that branch to the latest development branch and send a PR :-)
Yes I'm open to a PR for this (as long as it includes unit tests, add readme docs, etc)
I created the PR #346 , I added a test but I'm open to suggestions. I'll add an example and the documentation asap :-)