issue 5463 - Clarify Hibernate ORM property setting in prod

This commit is contained in:
Emmanuel Bernard
2019-11-14 13:32:55 +01:00
parent fa0339c155
commit f525bf9a58
2 changed files with 25 additions and 2 deletions

View File

@@ -257,7 +257,7 @@ your entity changes or any change to your `import.sql` is immediately picked up
[TIP]
--
By default, Hibernate ORM, upon boot, will read and execute the SQL statements in the `/import.sql` file (if present).
By default in `dev` and `test` modes, Hibernate ORM, upon boot, will read and execute the SQL statements in the `/import.sql` file (if present).
You can change the file name by changing the property `quarkus.hibernate-orm.sql-load-script` in `application.properties`.
--
@@ -304,6 +304,29 @@ This is great because you can define different combinations of Hibernate ORM pro
./mvnw compile quarkus:dev -Dquarkus.profile=dev-with-data
--
== Hibernate ORM in production mode
Quarkus comes with default profiles (`dev`, `test` and `prod`).
And you can add your own custom profiles to describe various environments (`staging`, `prod-us`, etc).
The Hibernate ORM Quarkus extension sets some default configurations differently in dev and test modes than in other environments.
* `quarkus.hibernate-orm.sql-load-script` is set to `no-file` for all profiles except the `dev` and `test` ones.
You can override it in your `application.properties` explicitly
(e.g. `%prod.quarkus.hibernate-orm.sql-load-script = import.sql`)
but we wanted you to avoid overriding your database by accident in prod :)
Speaking of, make sure to not drop your database schema in production!
Add the following in your properties file.
[source]
.application.properties
--
%prod.quarkus.hibernate-orm.database.generation = none
%prod.quarkus.hibernate-orm.sql-load-script = no-file
--
[[caching]]
== Caching

View File

@@ -72,7 +72,7 @@ public class HibernateOrmConfig {
* @asciidoclet
*/
// @formatter:on
@ConfigItem(defaultValueDocumentation = "import.sql (DEV,TEST)")
@ConfigItem(defaultValueDocumentation = "import.sql in DEV, TEST ; no-file otherwise")
public Optional<String> sqlLoadScript;
/**