by amacneil · 5y ago · 0 comments
I found most database migration tools tried to be too smart (I'm not a fan of automatic migrations), were too tightly integrated with specific languages or frameworks, or didn't support basic developer workflow pleasantries such as dropping and recreating the database.
I created a simple single binary migration tool that runs migrations (sql files), and keeps track of applied migrations in a table (inspired by Active Record migrations). Dbmate works with any language or framework, and generally tries to be useful while staying out of your way.
Comparison against other tools here: https://github.com/amacneil/dbmate#alternatives
I’ve used it very successfully in production for a few years and have been curious if anyone else would find it useful enough for me to open it up.
It would be great to generate Go stubs from the SQL definitions and I don't do that. I'd like something a bit like dotsql but ideally where it creates actual Go funcs out of the SQL function signatures.
The bit that I've done so far lets you package up SQL functions into a schema and treat them as a Go package. you can include them in go.mod and the functions are maintained without writing migration scripts.
I'm under the pump at the moment but I'll try to write something up about it and maybe ping you on github some time. Sorry i don't have much time at the moment!