migrax generate writes migrations, and three commands handle the rest: status shows what the database has, migrate applies what is missing, and rollback undoes it. This article goes through each one on a real project. It also covers what a rollback can and can't bring back, and what happens when someone edits a migration that already ran.
Tested with: Migrax 0.17.1, Hibernate 6.6.13, PostgreSQL 17. Every output below was copied from a real run.
Where we start
The shop project from the earlier articles has four applied migrations: the first tables, a phone column, and the two renames from Renaming columns and tables without losing data . Now two more entity changes come in: a notes field on PurchaseOrder , and an index on its createdAt column.
@Entity @Table ( name = "purchase_orders" , indexes = @Index ( name = "ix_orders_created" , columnList = "createdAt" )) public class PurchaseOrder { ...…