在我的Spring Boot项目中,我配置了Actuator端点。我想使用/liquibase
端点来检查Liquibase迁移状态,但收到以下异常:
org.postgresql.util.PSQLException: ERROR: relation "public.databasechangelog" does not exist
这是因为我已经重新配置了我的项目,使用system
PostgreSQL模式用于技术Liquibase表而不是public
。
如何告诉执行人员查看system
架构而不是public
?
已更新
我已按以下方式配置Liquibase:
@Configuration
public class LiquibaseConfig {
@Value("${liquibase.context}")
private String context;
@Value("${system.schemaName}")
private String schemaName;
@Autowired
private DataSource dataSource;
@Bean
@DependsOn(value = "loggerProperties")
public SpringLiquibase liquibase() {
SpringLiquibase liquibase = new SpringLiquibaseExt(schemaName);
liquibase.setContexts(context);
liquibase.setDataSource(dataSource);
liquibase.setChangeLog("classpath:changelog/db.changelog.xml");
return liquibase;
}
private static class SpringLiquibaseExt extends SpringLiquibase {
private String schemaName;
public SpringLiquibaseExt(String schemaName) {
this.schemaName = schemaName;
}
@Override
protected Database createDatabase(Connection c, ResourceAccessor resourceAccessor) throws DatabaseException {
Database database = super.createDatabase(c, resourceAccessor);
database.setLiquibaseSchemaName(schemaName); //schema = system
return database;
}
}
}