Use if the DDL is needed as an exported file. This will work even if hibernate.ddl-auto
is set to validate
or other state which will not modify the database. Usefull to generate data migrations for tools like Flyway.
Settings for Create and Delete Source Properties (properties.javax.persistence.schema-generation.create-source
)
metadata - Use the object/relational metadata in the application to create or delete the database artifacts.
script - Use a provided script for creating or deleting the database artifacts.
metadata-then-script - Use a combination of object/relational metadata, then a user-provided script to create or delete the database artifacts.
script-then-metadata - Use a combination of a user-provided script, then the object/relational metadata to create and delete the database artifacts.
Schema Creation Actions (properties.javax.persistence.schema-generation.scripts.action
)
none - No schema creation or deletion will take place.
create - The provider will create the database artifacts on application deployment. The artifacts will remain unchanged after application redeployment.
drop-and-create - Any artifacts in the database will be deleted, and the provider will create the database artifacts on deployment.
drop - Any artifacts in the database will be deleted on application deployment.
Create script location: properties.javax.persistence.schema-generation.scripts.create-target: create.sql
Drop script location: properties.javax.persistence.schema-generation.scripts.drop-target: drop.sql
Thanks a lot, mate for sharing this gist 🥇 🙏