I created Boot application with JPA, Liquibase, Web, H2 dependencies and enabled h2 console.
Boot version is 1.5.4-RELEASE.
When I run the application without updating liquibase application properties, tables are created.
When I set properties to:
and connect to http://localhost:8080/h2-console/ using
Then no tables are created.
When I switch back to Boot version 1.5.3-RELEASE, it works
When I don't specify liquibase application properties (I go with default) using 1.5.4-RELEASE, tables are created.
It seems it is some regression issue.
My wild guess is it might be related to https://github.com/spring-projects/spring-boot/issues/9218.
I pushed sample app to reproduce the issue here: https://github.com/pmihalcin/liquibase-spring-boot-issue
I can see the tables being created
2017-06-23 14:05:53.544 INFO 18207 --- [ main] liquibase : classpath:/db/changelog/db.changelog-master.yaml: classpath:/db/changelog/db.changelog-master.yaml::1::marceloverdijk: Table person created
2017-06-23 14:05:53.544 INFO 18207 --- [ main] liquibase : classpath:/db/changelog/db.changelog-master.yaml: classpath:/db/changelog/db.changelog-master.yaml::1::marceloverdijk: ChangeSet classpath:/db/changelog/db.changelog-master.yaml::1::marceloverdijk ran successfully in 4ms
2017-06-23 14:05:53.548 INFO 18207 --- [ main] liquibase : classpath:/db/changelog/db.changelog-master.yaml: classpath:/db/changelog/db.changelog-master.yaml::2::marceloverdijk: New row inserted into person
2017-06-23 14:05:53.549 INFO 18207 --- [ main] liquibase : classpath:/db/changelog/db.changelog-master.yaml: classpath:/db/changelog/db.changelog-master.yaml::2::marceloverdijk: ChangeSet classpath:/db/changelog/db.changelog-master.yaml::2::marceloverdijk ran successfully in 1ms
This is probably a side effect of the issue you've created. Closing the DataSource means that H2 will actually stop the complete embedded database instance.
I fail to see why you'd use that configuration with an in-memory database. What is the use case?
I couldn't think of a single use case where configuring a custom DataSource with an in-memory database is required but if you really want to do that, configure H2 so that it doesn't ditch everything on close.
I've replaced your liquibase.url property as follows and the tables are available using the H2 console.
liquibase.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
My use-case: having H2 for development purposes by default, Oracle for PROD, liquibase update for both approaches
Thanks for the liquibase.url, it works :+1:
Most helpful comment
I couldn't think of a single use case where configuring a custom
DataSourcewith an in-memory database is required but if you really want to do that, configure H2 so that it doesn't ditch everything on close.I've replaced your
liquibase.urlproperty as follows and the tables are available using the H2 console.