Proper way to deal with evolutions in functional tests

31 views
Skip to first unread message

Sindri Traustason

unread,
Jun 16, 2016, 12:14:36 PM6/16/16
to play-framework
I just added the first evolution, 2.sql, and now the functional tests all fail.

I'm running tests using 

    running(testServer(3333, fakeApplication(inMemoryDatabase("default", ImmutableMap.of("MODE", "MYSQL")))), ()-> ...

However running the second evolution fails with " play.api.db.evolutions.DefaultEvolutionsApi - Duplicate column name".

I tried stepping through the evolution runner and in line play.api.db.evolutions.EvolutionsApi.scala:196 I can see the scripts contains the actual script from 2.sql, but script 1 in the list seems to be a generated create script which includes the column 2.sql is adding.

How do I get inMemoryDatabase to run the actual evolution scripts? 

Can I run only the generated script and not 2.sql?

Orignally posted this as a question on stackoverflow: http://stackoverflow.com/questions/37862951/evolutions-not-working-in-play-framework-functional-tests

Nick Howes

unread,
Jun 22, 2016, 10:25:19 AM6/22/16
to play-framework
Evolutions should work fine in a functional test - is it possible to post the content of your 1.sql and 2.sql?

On the other hand, if you're saying that your first evolution is called 2.sql, then you should start at 1 and rename it to 1.sql.
Reply all
Reply to author
Forward
0 new messages