A while back, I wrote Careful with That Lock,Eugene about an idea for how to check if a database migration is likely to disturb production. That post

Robin's blog – Careful with That Lock, Eugene: Part 2

submited by
Style Pass
2024-05-07 06:00:07

A while back, I wrote Careful with That Lock,Eugene about an idea for how to check if a database migration is likely to disturb production. That post came about after having an inspiring chat with a colleague about the advantages of transactional migration scripts and the ability to check the postgres system catalog views before committing a transaction.

Over the past few weeks, I've been experimenting with this idea to test if I can use it to build valuable safety checks for DDL migrations. Kind of like shellcheck, but for database DDL migrations.

At this point, I've made enough progress to share some results. I've been working on a Rust project that compiles a command line tool named eugene and published it to crates.io and ghcr.io/kaaveland/eugene.

There exists some table books already, and we want to enforce both that the title column is not null and that it is unique. Suppose you commit this to a branch and make a pull request, then a minute later, the pull request is updated with a comment generated by eugene trace -f markdown alter_column_not_null.sql that looks like this:

Leave a Comment