mysqlspringspring-bootherokucleardb

How to prevent ClearDB (MySQL) from dropping when heroku puts my app to sleep


I have deployed a Spring Boot app on heroku and installed ClearDB addon which is just MySQL database. I am using free plan so I don't mind that my app is going to sleep after an hour of inactivity but I have one issue - database drops after app is going to sleep. I am wondering if that's just how heroku works when using free service or if it can be changed in heroku settings.

I am using auto ddl set to create in my application.properties, can it be the reason?


Solution

  • That behaviour is caused by your application.properties, it's not related to Heroku. You should change it to update instead of create because with create the database schema will be dropped and created afterwards. More info here