pierrefevrier
pierrefevrier

Reputation: 1640

Spring Boot Actuator Liquibase endpoint fail

I'm trying to use Liquibase with Spring Boot. Here is my application.properties file:

# ----------------------------------------
# DATA PROPERTIES
# ----------------------------------------

spring.datasource.url=jdbc:postgresql://xxxxxx:5432/dev
spring.datasource.schema=my_schema
spring.datasource.username=my_username
spring.datasource.password=my_password

# LIQUIBASE (LiquibaseProperties)
liquibase.default-schema=${spring.datasource.schema}
liquibase.user=${spring.datasource.username}
liquibase.password=${spring.datasource.password}

Change sets are well applied (table creation is ok).

The problem comes when I access /liquibase actuator's endpoint, I get a 500 error:

Unable to get Liquibase changelog

I also get the following log:

org.postgresql.util.PSQLException: ERROR: relation "public.databasechangelog" does not exist

If thing the problem is the schema prefix used to access changelog table: "public" versus "my_schema".

I thought spring.datasource.schema was the right parameter to set ?

Upvotes: 2

Views: 1440

Answers (2)

pierrefevrier
pierrefevrier

Reputation: 1640

Here is a working solution (come from this answer):

# ----------------------------------------
# DATA PROPERTIES
# ----------------------------------------

spring.datasource.url=jdbc:postgresql://xxxxxx:5432/dev?currentSchema=my_schema

Upvotes: 1

SteveDonie
SteveDonie

Reputation: 9016

Just a guess here - I think that the issue is that your 'real' schema is being set by the spring.datasource.schema but the liquibase tables are being stored in public and it may be that the Spring Boot actuator doesn't know that those can be separate.

Upvotes: 0

Related Questions