Repository navigation
[7.x] Allow turning evolutions script generation on or off per Ebean server - #903
Merged
Merged
Conversation
Rename play.ebean.readOnlyDatasources.<server> to play.ebean.db.<server>.readOnlyDatasource, so that all settings of a single Ebean server live in one place, like Play's own play.evolutions.db.<name> settings. The previous setting has not been released yet.
play.ebean.generateEvolutionsScripts turns the generation of the evolutions scripts on or off for all Ebean servers. The new play.ebean.db.<server>.generateEvolutionsScripts setting overrides it for a single Ebean server, in both directions, e.g. to not generate a script for a read-only database, or for a database whose evolutions come from the classpath, which a generated conf/evolutions file would shadow. This is independent of Play's play.evolutions.db.<name>.enabled setting, and nothing changes unless the new setting is used. Custom EbeanConfig implementations keep working, as the new per-server method defaults to the global setting.
Without any configured models, Ebean searches the classpath for them, and finds the models of the new evolutions scripts test. So the tests using an empty models list wrote conf/evolutions/default/1.sql into the working directory.
Contributor
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
7.x.Turn evolutions script generation on or off per Ebean server
play.ebean.generateEvolutionsScriptsturns the generation of the evolutions scripts (conf/evolutions/<server>/1.sql, in dev and test mode) on or off for all Ebean servers. The newplay.ebean.db.<server>.generateEvolutionsScriptssetting overrides it for a single Ebean server, in both directions:For example, for:
conf/evolutions/<name>/1.sqlon the filesystem first, so a generated file shadows these scriptsplay.evolutions.db.<name>.enabled = false), but whose generated script is still wanted, e.g. for a DBAThat's why the setting is independent of Play's
play.evolutions.db.<name>.enabled. Nothing changes unless the new setting is used.Until now, the only per-database way was to remove the
-- Created by Ebean DDLheader fromconf/evolutions/<name>/1.sql(or to create that file with other content), after which Play Ebean doesn't touch it anymore. The docs now explain both that and the new settings.EbeanConfiggets a newgenerateEvolutionsScripts(String server)default method, which falls back togenerateEvolutionsScripts(), so custom implementations keep working.DefaultEbeanConfigandEbeanParsedConfigkeep their existing constructors.Move the read replica setting to
play.ebean.db.<server>So that all settings of a single Ebean server live in one place, like Play's own
play.evolutions.db.<name>settings, the read replica setting from #892 moves fromplay.ebean.readOnlyDatasources.<server>toplay.ebean.db.<server>.readOnlyDatasource. It has not been released yet, so only snapshot users need to rename it.Testing
EbeanEvolutionsScriptsTestwith two Ebean servers, each with its own model: scripts get generated for both by default (with Play's evolutions disabled, so that's independent), for none when turned off globally, and selectively when overridden per server in either direction; an unknown Ebean server name fails at startup. The two per-server tests fail without the change. For this, the build now enhances the models of the tests too.EbeanParsedConfigTest;EbeanReadOnlyDatasourceTestuses the renamed setting.conf/evolutions/default/1.sqlinto the working directory.