Search code examples
mysqlplayframeworkplayframework-2.3playframework-evolutions

Play! Framework - Evolution don't start automatically on Server with MySQL


After starting my application on the server it connects with my MySQL database.

2015-04-19 17:00:38,636 - [INFO] - from play in main 
database [default] connected at jdbc:mysql://localhost/crowdfundme

But then it crashes everytime the database is involved.

Cannot invoke the action, eventually got an error:   javax.persistence.PersistenceException: Query threw SQLException:Table  'crowdfundme.user' doesn't exist 
Bind values:[] 
Query was:
select t0.id c0, t0.name c1, t0.age c2, t0.money c3, t0.nationality c4, t0.has_funded c5, t0.has_answered_questions c6, t0.chosen_bike c7,   t0.funding_amount c8, t0.money_before_funding c9 from user t0 

The evolution script is not applied, but it can't be applied because there is no possibility to do it, when I load the page for the first time.

I tried with the normal tricks to apply the evolution script automatically:

evolutionplugin=enabled
applyEvolutions.default=true
applyDownEvolutions.default=true

But now I can't think any further. Maybe there is something totally simple I can't see by myself? Thanks for every answer!


Solution

  • So I found out by myself. You have to let play generate the evolution scheme. Use in your application.conf db.default.url="jdbc:h2:mem:play;MODE=MYSQL" to create the evolution with the MySQL dialect. In my case I had to delete the "sequences" in the 1.sql so that is worked with my MySQL database on my server, but maybe you can find a substitute.