1

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.

3
  • If you are a beginner, simplify your work and do not use evolution. Just update your db model and go one in coding. Just like this. Commented Aug 5, 2016 at 14:17
  • I just wonder that such an elementary operation won't be possible? Commented Aug 5, 2016 at 14:19
  • 1
    You probably need to follow these steps: 1) Mark the database error as manually fixed (when you try to navigate to your app, there will be a button to enable you to do that) 2) Fix the script while paying attention to the DOWNS section too and 3) Try to start the app again with the corrected script. Commented Aug 5, 2016 at 15:00

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.