-
schema.sql
- src/main/resources
1 | DROP TABLE IF EXISTS USERS; |
data.sql
1 | INSERT INTO |
note
Spring boot 2, database initialization only works for embedded databases (H2, HSQLDB, …) If you want to use it for other databases as well, you need to change the spring.datasource.initialization-mode property
1
spring.datasource.initialization-mode=always
If you’re using multiple database vendors, you can name your file data-h2.sql or data-mysql.sql depending on which database platform you want to use.
To make that work, you’ll have to configure the spring.datasource.platform property though:1
spring.datasource.platform=h2