2

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 ?

pierrefevrier
  • 1,362
  • 1
  • 21
  • 29

2 Answers2

1

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

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

spring.datasource.url=jdbc:postgresql://xxxxxx:5432/dev?currentSchema=my_schema
Community
  • 1
  • 1
pierrefevrier
  • 1,362
  • 1
  • 21
  • 29
0

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.

SteveDonie
  • 7,440
  • 3
  • 36
  • 37