Gradle flyway How to figure out schema version and decide if upgrade is required or not?

StackOverflow https://stackoverflow.com/questions/22266009

  •  11-06-2023
  •  | 
  •  

문제

My requirement is to write a gradle task and using flyway plugin that will do the following:

  1. If database does not exist then execute gradle flywayInit and gradle flywayMigrate
  2. If database does exist but not at latest schema version then execute gradle flywayMigrate
  3. If database exists and at latest version, then do nothing

I am aware of the flywayInfo command but how do I use it within a gradle task to figure out what is the status of the database?

도움이 되었습니까?

해결책

gradle flywayMigrate -DinitOnMigrate=true satisfies all 3 requirements

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top