mysqlplayframeworkslicktypesafe-activatorplayframework-evolutions

Play Framework: How to correct SQL syntax error in evolution script?


I just added an SQL file to create a new table in my database to my evolution scripts. Accidentally, I had a typo in my SQL script. I then started my Play webapp via activator with config setting applyEvolutions.default=true. Consequently, when I run my webapp, it complains due to a SQL syntax error and inconsistent database.

I corrected the syntax error, but somehow Play/Evolutions/Activator does not consider my corrections. It still wants to execute the wrong and uncorrected version of my SQL script. This is obvious since it cites my syntax error from the uncorrected version. How can I make Play accept my corrected SQL script?

Additionally, Play states the following error message:

play.api.db.evolutions.InconsistentDatabase: 
Database 'default' is in an inconsistent state!
[An evolution has not been applied properly.

I use very recent Play, Evolution and MySQL versions.


Solution

  • I found out that the answer to my question is already there in the official documentation:

    Run the fixed SQL command on your database and then mark this problem as manually resolved by clicking on the button.

    But because your evolution script has errors, you probably want to fix it. So you modify the sql evolutions script.

    Play detects this new evolution that replaces the previous one, and will run the appropriate script. Now everything is fixed, and you can continue to work.

    https://www.playframework.com/documentation/2.5.x/Evolutions#inconsistent-states