Skip to content

Frameworks and build tools

Migrax doesn't depend on any framework, or on Java. It works in two ways:

  • Any language: you write SQL migrations, Migrax applies them with history, checksums, locking and rollbacks. Python, Node.js, Go, .NET, PHP, Ruby or anything else: see Any language. The container image needs only Docker.
  • Java with JPA entities: Migrax also writes the migrations for you from your entities, with the frameworks below.

For Java applications, Migrax comes in two parts, and most projects use both: a tool for your terminal (the Maven plugin, the Gradle plugin or the migrax command-line tool) that writes and checks the migrations, and a startup library for your framework that applies them when the application starts. Each framework page begins with what to add.

Migrax reads your entities and talks to the database over JDBC, so the command line works the same everywhere. What differs per framework is:

  • where the database settings are, which Migrax reads for you;
  • how Hibernate names tables and columns, which Migrax must match exactly;
  • how migrations can run at startup, through a small integration library.

Migrax recognizes the framework from your build file and configuration. migrax doctor shows what it detected.

Framework Database settings Naming Startup integration
Spring Boot spring.datasource.* spring migrax-spring-boot-starter
Quarkus quarkus.datasource.* jpa migrax-quarkus
Micronaut datasources.default.* micronaut with Micronaut Data, else jpa migrax-micronaut
Helidon javax.sql.DataSource.<name>.*, db.connection.* (SE) jpa migrax-helidon (MP)
Jakarta EE, plain Hibernate persistence.xml jpa migrax-jakarta-ee
Any language MIGRAX_DATABASE_URL and the other MIGRAX_* variables (no entities) the container image, before the application starts

Build tools: Maven plugin and Gradle plugin.

Getting the integration libraries

The libraries and both build plugins are on Maven Central from Migrax 0.14.0 on: add the dependency or plugin shown on each page, and Maven or Gradle downloads it. For 0.13.0 and older, install them from the source instead (mvn install, then mvn install -f integrations/pom.xml, in a clone of the repository).

Upgrading from 0.3 or older

Since 0.4.0, Migrax is published as org.migrax instead of io.migrax: the groupId, the Gradle plugin ID (id("org.migrax")), the Java packages (org.migrax.api.JavaMigration) and the logger name. Replace io.migrax with org.migrax in your build files, Java migrations and logging configuration. During the upgrade, let only one instance run migrations against a database at a time: 0.3 and 0.4 use differently named migration locks.