Issue
I made a project from scratch just with the schema.sql and the data.sql just to try the schema.sql and the data.sql:
- https://github.com/rmmcosta/TestSchema Everything works fine. The table inside schema.sql is created in a MySql database (previously created and the grants were given to the user defined in application.properties) and the data.sql populates the data as it's supposed to do.
But, when I change schema.sql and data.sql to schema-mysql.sql and data-mysql.sql and I put in the application.properties the property spring.datasource.platform=mysql the schema-mysql.sql and the data-mysql.sql are not being executed. No errors are being thrown, simple nothing happens on the database. I tried with spring boot 2.2.4 and it works fine, but with spring boot 2.7.5 it isn't working.
Do you know if the spring.datasource.platform was deprecated? And if so, do you know how can I set the application.properties in order to run schema-mysql.sql?
Thank you in advance, Ricardo
Note: I tried without using spring.datasource.platform=mysql and with schema.sql and data.sql and everything works fine. I tried with an old project, spring boot 2.2.4 and java 1.8, and works fine.
Solution
Do you know if the spring.datasource.platform was deprecated? And if so, do you know how can I set the application.properties in order to run schema-mysql.sql?
The property name changed to spring.sql.init.platform
Which occurred in Spring Boot 2.5: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.5.0-RC1-Configuration-Changelog
Answered By - R4N
Answer Checked By - Marie Seifert (JavaFixing Admin)