playframework/playframework — pull request #2483 by mkurz (2014-03-13 18:40:12+00:00)
Title: Allow evolutions to be applied in one single transaction

Like in Play 1, it should be possible that evolution scripts get applied in one single transaction. Currently each statement is commited to the db immediately (autocommit=true).

We could stick with the current behaviour by default for backward compatibility, but allow to change it by setting
`evolutions.autocommit=false`
in application.conf.

IMHO this makes a lot of sense. When evolutions fail, nothing in the database changes and you can just fix your scripts without the need to modify/rollback the database by hand. This makes sense in production, so you don't mess up your (sensitive) database with only parts of your evolutions scripts. Actually I'm wondering why this isn't the default behaviour.

[Here](http://play.lighthouseapp.com/projects/57987/tickets/1036-evolutions-cannot-be-applied-in-transactions-on-databases-that-support-it) is the ticket for play 1, which gives lots of good arguments to implement a fix for this (especially [this comment](http://play.lighthouseapp.com/projects/57987/tickets/1036-evolutions-cannot-be-applied-in-transactions-on-databases-that-support-it#ticket-1036-4)).

I'm not that much into Scala yet, otherwise I would fix this by myself, but hopefully someone can have a look at it - it shouldn't be that hard.

Thanks!