

If you like to use a different DataSource, you can create one and mark its as you do so and want two data sources, remember to create another one and mark it as you can use Flyway’s native DataSource by setting spring.flyway. They can be ordered by using or by implementing Ordered.īeans that implement the deprecated Flywa圜allback interface can also be detected, however they cannot be used alongside Callback beans.īy default, Flyway autowires the ( DataSource in your context and uses that for migrations. To use Java-based callbacks, create one or more beans that implement Callback.Īny such beans are automatically registered with Flyway. To use SQL-based callbacks, place the callback scripts in the classpath:db/migration folder. If you would like more control, provide a that implements FlywayMigrationStrategy. Spring Boot calls Flyway.migrate() to perform the database migration. If you need more control over the configuration, consider registering a Flywa圜onfigurationCustomizer bean. The list of supported databases is available in DatabaseDriver.įlywayProperties provides most of Flyway’s settings and a small set of additional properties that can be used to disable the migrations or switch off the location checking. Rather than using db/migration, the preceding configuration sets the folder to use according to the type of the database (such as db/migration/mysql for MySQL). This is a comma-separated list of one or more classpath: or filesystem: locations.įor example, the following configuration would search for scripts in both the default classpath location and the /opt/migration directory: =classpath:db/migration,filesystem:/opt/migration The migrations are scripts in the form V_.sql (with an underscore-separated version, such as ‘1’ or ‘2_1’).īy default, they are in a folder called classpath:db/migration, but you can modify that location by setting. To automatically run Flyway database migrations on startup, add the org.flywaydb:flyway-core to your classpath. 86.5.1 Execute Flyway Database Migrations on Startup
