I'm writing a build tool for SQL. I like to write SQL directly and to use it's more powerful features (like stored procedures and Postgres' ltee extension). But this is gets difficult to manage in a linear, "migrations" based workflow. I want to edit a file tree organized by topic, not a series of scripts run in order. Which is to say, I want to edit it like I would any other codebase.
I've written code allowing me to express dependencies between .sql files and to concatenate them into one big .sql file that builds your schema. I'm working on interrogating the systems tables of the database to analyze the difference between successive versions of a schema, to automatically generate simple migrations (like adding a column or renaming a stored procedure). Eg, `sqlite_master` in SQLite, and `information_schema.*` in Postgres.