Skip to content

Explain how to use the database schema during application startup - #913

Merged
mkurz merged 1 commit into
playframework:mainfrom
mkurz:docs-ebean-startup-evolutions
Oct 9, 2026
Merged

mkurz merged 1 commit into
playframework:mainfrom
mkurz:docs-ebean-startup-evolutions

Conversation

@mkurz

@mkurz mkurz commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

The section "Using Ebean during application startup" (#910) said that depending on ApplicationEvolutions doesn'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 on ApplicationEvolutions gets created after Play checked (and, with autoApply, applied) the evolutions, so it can use the schema if upToDate() returns true. In dev mode, applying the evolutions in the browser reloads the application, which creates the component again. As ApplicationEvolutions depends on DynamicEvolutions, 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 that 8.x and 7.x use.

Testing

  • The new sample gets compiled by the docs build, and a new test in JavaEbeanTest creates 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)

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.
@mergify

mergify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
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.

@mkurz
mkurz merged commit d03815d into playframework:main Oct 9, 2026
80 checks passed
@mkurz
mkurz deleted the docs-ebean-startup-evolutions branch October 9, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant