I have a spring boot backend application and I'm looking for a way to insert initialization data in a MySQL database but only each time the tables are created. I did that with data.sql but the data gets inserted every time the server starts. I hope my question is clear. Thank you for your time :)
Database initialising provided by Spring Boot is meant to be used only with embedded databases. So it more or less assumes that you have to initialise the database on every start of the application.
For the proper initialising and evolution of persistent databases use Flyway or Liquibase
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With