Change an entity
Add a field, rename a column, create a table. Write Java as usual.
Run migrax generate
Get readable SQL and a rollback script, checked for risky statements.
Run migrax migrate
Apply it from the command line, in CI, or when the application starts.
See it in 30 seconds
Change an entity, and Migrax writes the SQL and the script that undoes it.
The new column, and a rollback script that says which data undoing it would delete.
A dropped column next to a new one looks like a rename. Migrax asks, and renames it so the
data stays; in CI it stops and tells you to pass --rename.
@Entity
@Table(name = "orders")
public class PurchaseOrder {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;
@ManyToOne(optional = false)
Customer customer;
@Column(nullable = false, precision = 12, scale = 2)
BigDecimal total;
}
CREATE TABLE orders (customer_id bigint NOT NULL, id bigint GENERATED BY DEFAULT AS IDENTITY NOT NULL, total numeric(12,2) NOT NULL, CONSTRAINT orders_pkey PRIMARY KEY (id));
ALTER TABLE orders ADD CONSTRAINT fk_orders_customer_id_54d4cc52 FOREIGN KEY (customer_id) REFERENCES customers (id);
Types and keys come from Hibernate's own mapping, so they match what Hibernate expects; unnamed constraints get readable names.
@Column(name = "full_name", nullable = false, length = 100)
String fullName;
-
- @Column(length = 30)
- String phone;
}
Nothing is dropped until you say --allow-destructive, and the rollback script warns that
it can't bring the data back.
Why teams use Migrax
Everything a migration needs, checked before it reaches production.
-
Migrations written for you
Change an entity, run
migrax generate. Tables, columns, keys, indexes, join tables, element collections, sequences and inheritance come out exactly as your Hibernate, EclipseLink or OpenJPA maps them. -
Checked before production
Every migration is linted for statements that lock big tables, fail on existing rows or break running instances.
migrax verifychecks the result against your mapping, and Hibernate validates it itself. -
Rollback included
Each generated migration comes with a rollback script, and
verifytests every one of them: roll back, apply again, same schema. -
Asks before it loses data
A dropped column that looks renamed? Migrax asks, and renames it so the data stays. Drops only happen when you say
--allow-destructive. -
Catches manual changes
migrax driftcompares the live database with what your migrations produce and lists every difference, including columns someone made narrower. -
Zero setup
Run it in your service folder. It compiles the project, finds the dependencies and reads the database settings from your application configuration.
Works with your stack
Detected automatically. No plugin configuration needed to get started.
From the blog
How-tos and the thinking behind Migrax. All articles
Spring Boot: migrations at startup, health checks and metrics
Apply database migrations when a Spring Boot application starts, before JPA, and see them in Actuator: a health check, Prometheus metrics, several instances starting together, and what changes when a pipeline runs the migrations instead.
Generate and apply database migrations without leaving IntelliJ IDEA
Rename a JPA field and let the Migrax plugin for IntelliJ IDEA write the migration, ask whether it was a rename, and apply it, with screenshots from a real run.
Generated SQL migrations for Python, TypeScript and Go projects
Your ORM already knows the schema. Export it as SQL, and Migrax writes versioned migrations with rollback scripts for SQLAlchemy, Drizzle and GORM projects, then checks them in CI.
Ready when your next entity changes
Install the command line tool in a minute, then run it in any service folder.