Having Spring to Create the Database Schema
- Add the following in the application.properties file:
spring.jpa.properties.javax.persistence.schema-generation.scripts.action=drop-and-create spring.jpa.properties.javax.persistence.schema-generation.scripts.drop-target=drop.sql spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=create.sql spring.jpa.properties.javax.persistence.schema-generation.scripts.create-source=metadata
- The create.sql, and drop.sql script will be created in the root directory. If those files have already existed, you might want to delete those first.
- The SQL files are created based on your datasource driver.
- Remove the above lines from the properties file afterward.