Re:Ask HN: What are some tools / libraries you built yourself?
by doctor_eval on Sunday May 16, 2021 @05:40PM
(#27177251)
I found that I wanted something really specific, and built a tool in Go that lets you write, modify and use plpgsql functions as if they were regular source code files rather than database objects. You can write them as Go packages, import those packages into other Go projects, and write tests - without maintaining migration files for anything other than the tables. Combined with IDEA’s plpgsql language support it’s made me super productive.
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.
Re:Ask HN: What are some tools / libraries you built yourself?
by newusertoday on Monday May 17, 2021 @02:05PM
(#27186254)
can you give more details, i am generating golang and js functions corresponding to plpgsql functions in somewhat hacky way. I am curious to know what approach have you taken, is it something similar to this project https://github.com/gchaincl/dotsql
Re:Ask HN: What are some tools / libraries you built yourself?
by doctor_eval on Thursday May 20, 2021 @08:12AM
(#27220121)
hey sorry i didn't see this earlier. it's not a code generator, as such, it's really just a structured way to write PLPGSQL functions alongside Go code, and have it deployed and upgraded automagically.
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!
Re:Ask HN: What are some tools / libraries you built yourself?
by danielheath on Sunday May 16, 2021 @06:59PM
(#27177956)
I definitely want something like that.
Re:Ask HN: What are some tools / libraries you built yourself?
by void_mint on Sunday May 16, 2021 @01:53PM
(#27175560)
Curious about the lack of comparison to https://flywaydb.org/ , which I've seen a ton of support for in the past and people seem to really enjoy
Re:Ask HN: What are some tools / libraries you built yourself?
by amacneil on Friday May 21, 2021 @03:05PM
(#27238492)
Flyway seems like a startup offering a hosted service, so it might be a strange comparison. But if you are familiar with it and care to submit a PR, I'd accept it!
Re:Ask HN: What are some tools / libraries you built yourself?
by asadawadia on Sunday May 16, 2021 @03:35PM
(#27176338)
I love Dbmate! Such a great library!
Re:Ask HN: What are some tools / libraries you built yourself?
by halostatue on Sunday May 16, 2021 @11:00PM
(#27179667)
Looks similar to Sqitch (https://sqitch.org).
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