Repository navigation
Explain how to use the database schema during application startup - #913
Merged
Merged
Conversation
A component that depends on ApplicationEvolutions gets created after Play checked (and, with autoApply, applied) the evolutions, so it can use the schema once upToDate() returns true. In dev mode, applying the evolutions in the browser reloads the application, which creates the component again.
This was referenced Oct 9, 2026
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 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.
The section "Using Ebean during application startup" (#910) said that depending on
ApplicationEvolutionsdoesn't help to use the database schema while components get created, as in dev mode it doesn't wait for pending evolutions. That's true, but incomplete: a component that depends onApplicationEvolutionsgets created after Play checked (and, withautoApply, applied) the evolutions, so it can use the schema ifupToDate()returnstrue. In dev mode, applying the evolutions in the browser reloads the application, which creates the component again. AsApplicationEvolutionsdepends onDynamicEvolutions, the Ebean databases exist as well.This replaces that sentence with a sample of that pattern, and keeps letting Play apply evolutions automatically in dev mode as an alternative, including the warning about downs.
Play's docs now describe this pattern as well (playframework/playframework#14339). That section isn't linked here, as so far it's only in the docs of Play's
main, not in the docs of the Play versions that8.xand7.xuse.Testing
JavaEbeanTestcreates it in test mode, where Play applies evolutions automatically, and checks that it inserted its initial data.cd docs && sbt "validateCode; test"passes.References
Backports: #914 (
8.x), #915 (7.x)