Search code examples
playframeworkplayframework-2.3playframework-evolutions

How to disable evolutions for one database


I have play-java project with two databases connected through ebean. First database is managed with evolutions, second database is used only for read only and I have no permissions to do any updates on it. So I have to disable evolutions only for one, the second database.

Currently I have spent some time and found no solutions and only misleading suggestions from stackoveflow and confusion from playframework issue cummunication list on the github site. As I understood this functionality will be available on new yet not released version 2.4 of playframework.

I just wondering that here should be some kind of workaround, but I can not find any. I have burning hot new feature request but see no workaround.

I saw few related questions, but those are quite old. I hope that something has changed since that time.

Regards Remis B


Solution

  • Play Extras has the ability to apply an enhanced evolutions plugin and it works with Play 2.0 applications.

    Enhanced Evolutions plugin that does locking so your dynos dont stomp on each other (will be in Play soon) and enable/disable evolutions per db.

    You can add the plugin by adding the following in your build file

    val extras = RootProject(uri("git://github.com/sclasen/play-extras.git"))
    
    val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA, settings = Defaults.defaultSettings ++ buildSettings).dependsOn(extras)
    

    You will need to disable the default evolution plugin in Play.

    evolutionplugin=disabled
    

    Further information on how to use the evolutions plugin can be found here.