You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Generated evolution scripts in projects without Play's layout #930
In a project that disables Play's layout (disablePlugins(PlayLayoutPlugin)), the resources are in src/main/resources instead of conf. With a simple play.evolutions[.db.<name>].path, like the default evolutions, Play's evolutions still look for the scripts in conf/<path>/<name>/ on the filesystem first, and only then on the classpath, and Play Ebean writes the generated script to conf/<path>/<name>/1.sql as well. So:
The generated script doesn't get packaged, so it's missing in production.
In dev and test mode, it takes precedence over a hand-written src/main/resources/evolutions/<name>/1.sql, which then only production uses.
The docs (#931) describe workarounds: generate the script into ./src/main/resources/evolutions in dev and test mode, and use the default path in production; or turn off generating the script, and delete a generated copy.
Proper support would need to know where the project's resources really are, e.g. from the sbt plugin. Guessing it from which folders exist doesn't work: it can't tell a conf folder that Play Ebean created itself apart, misses custom resource directories, and can change which script Play applies.
Thanks, that's a nicer variant: with devSettings, only sbt run uses ./src/main/resources/evolutions, and production keeps the default path, so it applies the packaged script without any override. I checked it with an application without Play's layout: in dev mode, Play Ebean writes src/main/resources/evolutions/default/1.sql, and the staged application applies it.
One thing to be aware of: devSettings only apply to sbt run, not to sbt test. In tests, Play Ebean still writes conf/evolutions/default/1.sql, and the tests apply that copy. To use the same location in tests, set the path in the test application's configuration too, e.g. new GuiceApplicationBuilder().configure("play.evolutions.path", "./src/main/resources/evolutions").
Activity
PromanSEW commentedon Oct 13, 2026
In
PlayServiceproject I use this setting:mkurz commentedon Oct 13, 2026
Thanks, that's a nicer variant: with
devSettings, onlysbt runuses./src/main/resources/evolutions, and production keeps the default path, so it applies the packaged script without any override. I checked it with an application without Play's layout: in dev mode, Play Ebean writessrc/main/resources/evolutions/default/1.sql, and the staged application applies it.One thing to be aware of:
devSettingsonly apply tosbt run, not tosbt test. In tests, Play Ebean still writesconf/evolutions/default/1.sql, and the tests apply that copy. To use the same location in tests, set the path in the test application's configuration too, e.g.new GuiceApplicationBuilder().configure("play.evolutions.path", "./src/main/resources/evolutions").