playframework/Play20 — pull request #688 by brikis98 (2013-01-21 19:29:51+00:00)
Title: Evolutions handleWebCommand should use DBPlugin from the app

To allow users to provide a custom `DBPlugin`, with a custom `DBApi`, the `Evolutions.handleWebCommand` function should pull the `DBPlugin` and `DBApi` from the running app instead of explicitly instantiating a new `BoneCPApi`.

This uncovered a strange side-effect: by default, h2 in-memory DB's will clear any data once the last DB connection is closed. The `Evolutions` code would close connections, but since it was originally creating a new `BoneCPApi` instance, this wasn't the *last* connection, so things worked fine. By using the app's `DBPlugin` in this pull request, we would end up closing the one and only connection, and all data would be lost after applying evolutions.

Therefore, I've added the `DB_CLOSE_DELAY` parameter to all h2 URLs to prevent this issue. This seems like the right thing to do for h2 anyway, or you may get other weird "where did my data go" scenarios in the future.