Skip to content

Commit 8041099

Browse files
committed
Polish "Enhance Database initialization how to guide"
See gh-21077
1 parent f2b10be commit 8041099

File tree

1 file changed

+7
-3
lines changed
  • spring-boot-project/spring-boot-docs/src/main/asciidoc

1 file changed

+7
-3
lines changed

spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,14 +1957,18 @@ For instance, if you want to always initialize the `DataSource` regardless of it
19571957
----
19581958
spring.datasource.initialization-mode=always
19591959
----
1960+
19601961
In a JPA-based app, you can choose to let Hibernate create the schema or use `schema.sql`, but you cannot do both.
19611962
Make sure to disable `spring.jpa.hibernate.ddl-auto` if you use `schema.sql`.
1963+
19621964
[indent=0,subs="verbatim,quotes,attributes"]
19631965
----
19641966
spring.jpa.hibernate.ddl-auto=none
19651967
----
1968+
19661969
If you are using a <<spring-boot-features.adoc#howto-use-a-higher-level-database-migration-tool,Higher-level Database Migration Tool>>, like Flyway or Liquibase, you cannot use basic SQL scripts to create and initialize the schema.
1967-
In this situation, if `schema.sql` and `data.sql` are present, they will be ignored. It is not possible to use a Database Migration Tool to manage schema creation, and a basic SQL script to initialize it.
1970+
In this situation, if `schema.sql` and `data.sql` are present, they will be ignored.
1971+
It is not possible to use a Database Migration Tool to manage schema creation, and a basic SQL script to initialize it.
19681972
====
19691973

19701974
By default, Spring Boot enables the fail-fast feature of the Spring JDBC initializer.
@@ -2063,8 +2067,8 @@ To automatically run Liquibase database migrations on startup, add the `org.liqu
20632067

20642068
[NOTE]
20652069
====
2066-
When you add the `org.liquibase:liquibase-core` to your classpath, by default database migrations will run for both during application startup and before your tests run.
2067-
This behavior can be customized by using the configprop:spring.liquibase.enabled[] property, setting different values in the `main` and `test` folders.
2070+
When you add the `org.liquibase:liquibase-core` to your classpath, database migrations run by default for both during application startup and before your tests run.
2071+
This behavior can be customized by using the configprop:spring.liquibase.enabled[] property, setting different values in the `main` and `test` configurations.
20682072
It is not possible to use two different ways to initialize the database (e.g. Liquibase for application startup, JPA for test runs).
20692073
====
20702074

0 commit comments

Comments
 (0)