Feature: run evolutions from sbt

50 views
Skip to first unread message

Stewart Stewart

unread,
Apr 12, 2016, 9:05:55 PM4/12/16
to Play framework dev
This feature is simple enough. I'd like a task in sbt that can run evolutions.

At present, evolutions are typically run by (1) making sure the app compiles, (2) running the app, (3) visiting the app from a browser.

None of those three seem necessary. Am I missing something? With those requirements, it's possible to enter a state where the code generated for Slick is wrong and preventing the app from compiling and the fix is an evolution.

What steps would need to be taken to implement this?

Will Sargent

unread,
Apr 12, 2016, 11:37:08 PM4/12/16
to Stewart Stewart, Play framework dev
Hi Stewart,

The play evolutions module is here:


and the module binding is here:


The behavior of Evolutions comes out of the fact that it's loaded at runtime with the application.

If you want a decoupled solution, I would check out Flyways.  There's an example application here:


that will work even in the case where the application itself is broken.

Will.



--
You received this message because you are subscribed to the Google Groups "Play framework dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stewart Stewart

unread,
Apr 13, 2016, 4:48:04 PM4/13/16
to Play framework dev, stewi...@gmail.com
Thanks, Will! I'll dig into this.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework-dev+unsub...@googlegroups.com.

Stewart Stewart

unread,
Apr 13, 2016, 5:06:14 PM4/13/16
to Will Sargent, Play framework dev
The main feature I'm interested preserving is Play's ability to run the appropriate downs and ups when you switch to a different branch. Is this not already a feature of Flyway?

Will Sargent

unread,
Apr 13, 2016, 8:34:21 PM4/13/16
to Stewart Stewart, Play framework dev
I haven't used Flyways in a branching long-term environment, so I don't know if they have that feature.  You can ask Boxfuse and check their documentation:


Will.

Stewart Stewart

unread,
Apr 13, 2016, 8:53:57 PM4/13/16
to Will Sargent, Play framework dev
I had a look earlier today. That doesn't seem to be the case.

Naftoli Gugenheim

unread,
Apr 14, 2016, 1:06:56 AM4/14/16
to Stewart Stewart, Will Sargent, Play framework dev

Flyway does not support down migrations, as a matter of principle.
However, if you're using H2, you can just close all connections to the database and copy a backup file over it (made by just copying the database file), so I don't find it to be an issue.
If you're using postgresql, run it in docker and taking a snapshot should be as simple as doing `docker commit `.
And I think they're right that in production you shouldn't use downs.

Reply all
Reply to author
Forward
0 new messages