Shmig: Database migration tool written in bash
github.com
github.com
> If you are writing a script that is more than 100 lines long, or that uses non-straightforward control flow logic, you should rewrite it in a more structured language now.
https://google.github.io/styleguide/shellguide.html
Sorry I hate to write snarky comments. The page says other tools have too many dependencies where this doesn't. That makes it a potentially valuable tool. If it works that's great.
There are so many pitfalls, so many weird interactions with pipes and error conditions in subprocesses, signals(!), etc. etc. that it can be hard to write even "bail as soon as ANYTHING goes wrong" logic.
(And that's not even accounting for things like "rm -rf $FOO/" going wrong. The shell fully embraced Stringly Typed Programming and this is the inevitable result.)
I have recently learned of linters and such for bash/sh scripts, but that's a bandaid at best.
Can you link some examples that you think would gladly process data-migrations that are 1-2GiB large?
psql -d mydb -f migration.sql
I use a home-built solution that does this (160 lines of go), doesn't seem very exotic to me and did not require lots of work as there are only a few requirements for a working solution: Unique ordered names for migration sql files, use the db to store metadata about migrations run, use the db tools to run migrations.