Source code for the blog post https://terrastruct.com/blog/post/generate-diagrams-programmatically/.
This is a runnable example that reads a (very) limited subset of SQL statements from
plan.sql and generates SVGs for each step, also outputting the final .d2 file when
it's done.
go run main.go