For play 1.x, we can use play evolutions:apply
, How can I do it in play-2.0-beta?
相关问题
- Play framework 2 : How to pass object between rout
- Cannot find sbt launcher 0.11.2
- Play! Framework - Can my view template be localise
- How to access SBT settings from Java code in PlayF
- Play framework: Why the cookie isn't showing
相关文章
- how to set H2 primary key id to auto_increment?
- Build maven project as a part of SBT build
- How does @Inject in Scala work
- how to handle fileupload into a table in play fram
- How to extend the Play2 scala zentasks authenticat
- Playframework & Guice without routing
- Is there a more appropriate way to set the languag
- Background jobs with Play Framework on Heroku
Evolution:apply is run automatically upon application start up. What is missing in Play 2.0-rc1 is a way to generate the evolutions scripts, and to manually apply them from the SBT console.
But here is how to create them manually.
Say you have the following definition in
application.conf
Play2 will look for evolution in the following folder:
application/db/evolutions/mydb/
In this folder, evolutions shall be stored as sql file, using the evolution step as the file name.For instance:
Now the sql itself has the following structure:
!Ups are used to upgrade the model to the next evolutions
!Downs are used to revert the !Ups
Like I said in the intro, evolutions will be magically applied upon application startup.