Now I have a spring-boot app which uses MsSQL server. And we use flyway for migrations.
I want to add an additional profile for tests. I want to generate tables from entity classes instead of using flyway.
I tried smth to write like this in application.yaml
spring:
profiles: test
jpa:
generate-ddl: true
hibernate:
datasource:
url: jdbc:h2:mem:test_db;MODE=MSSQLServer
username: sa
password:
but flyway starts anyway
Doesn't for for Spring Boot 2.X ! Correct answer is here.
Continue reading if you need an answer for Spring Boot 1.X.
There is a property available for spring-boot to disable flyway if it's needed flyway.enabled
which is true by default.
You can have a profile specific configuration, in your case it should be named as application-test.yml
. This configuration can disable flyway if profile is active. You just have to declare it as follows:
flyway:
enabled: false
And if you specify test profile in common configuration, just add it to it's root.