I'm setting up the flyway
migration for the spring-boot
project with PostgreSQL
but not able to connect with the database and getting below exception.
Failed to execute goal org.flywaydb:flyway-maven-plugin:6.0.8:migrate (default-cli) on project open-feign: org.flywaydb.core.api.FlywayException: Unable to connect to the database. Configure the url, user and password! -> [Help 1]
Spring boot version : 2.2.1.RELEASE
Maven :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>6.0.8</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>6.0.8</version>
</plugin>
application.yml
spring:
application:
name: MIGRATE DEMO
datasource:
url: jdbc:postgresql://localhost:5432/DABASENAME
driver-class-name: org.postgresql.Driver
username: postgres
password: root
platform: postgres
dbcp2:
validation-query: SELECT 1
jpa:
datbase: POSTGRESQL
database-platform: org.hibernate.dialect.PostgreSQL9Dialect
show-sql: true
generate-ddl: true
properties:
hibernate.jdbc.lob.non_contextual_creation: true
hibernate:
ddl-auto: validate
flyway:
user: postgres
password: root
schemas: DABASENAME
url: jdbc:postgresql://localhost:5432/DABASENAME
locations: filesystem:db/migration
Thanks In-advance
Finally it is working, below changes I made.
As per FlywayAutoConfiguration spring.flyway is expecting e.g.
spring.flyway:
Not able to read properties like below
spring:
flyway:
user: ....
Versioning format Vx.x__(description) [V(capital letter) 1.2(integer)__(two underscore characters)]