My setup is to use sql files versioned by date. Each file has changsets (regions demarcated by comments) for single transaction actions (like creating a database), along with it's rollback actions written as comments in it's respective changeset.
I don't trust rollbacks, I mostly use them for dev purposes for scripts that are wip. If i have to "undo" changes to a db, better to write specific scripts that revert the actions (i.e. manually move columns around to a tmp table).
I essentially just use liquibase as a language-agnostic db-migration tool that can connect ot a db and run a series of sql files. I could write scripts for that, but it's nice to have a third-party solution.
I haven't used it for 15 years, but this is exactly what I used to do. I felt like using SQL helped me understand what was actually happening to the database and having a tool that automatically did the right thing for applying those snippets between versions was great.
For example, think of one install going from 1.0.0 > 1.0.2 while another is going from 1.0.0 > 1.1.0. Sure, you could write something to do that yourself, but I'd rather use an existing library that already covers tons of edge cases.
The number of Docker containers I've used that need to be rolled through a special incantation of several versions to get things upgraded cleanly make me shake my head sometimes. Every time I have to do that I still think of Liquibase and wish that I could just grab the most recent version and have the database schema magically updated like I could do with Java apps 2 decades ago.
I find it crazier that people use xml changesets.
My setup is to use sql files versioned by date. Each file has changsets (regions demarcated by comments) for single transaction actions (like creating a database), along with it's rollback actions written as comments in it's respective changeset.
I don't trust rollbacks, I mostly use them for dev purposes for scripts that are wip. If i have to "undo" changes to a db, better to write specific scripts that revert the actions (i.e. manually move columns around to a tmp table).
I essentially just use liquibase as a language-agnostic db-migration tool that can connect ot a db and run a series of sql files. I could write scripts for that, but it's nice to have a third-party solution.