Question

I'm thinking of using Flyway for my database migration. Seems like it will be simpler than creating my own SQL and Java migration scripts. However, looking at the documentation there seems to be several ways to use it.

What should I consider when deciding between migrating with (a) application integration, (b) a maven task, or (c) the command line?

Currently I deploy to heroku with a simple git push. This builds my app and starts it as specified in the proc file.

So in this regard it seems like the application integration (migrating on startup) would be the simplest. But it also seems like overhead I don't need. I suppose if I do the maven task I would need to ensure that heroku calls maven correctly to make this happen.

What are the trade-offs? Is anyone currently using Spring + JPA + Flyway together with a heroku hosted application?

Was it helpful?

Solution

You are correct, the application integration is the simplest. Code and DB can never get out of sync.

The overhead is absolutely minimal, especially compared to JPA. The few millis it'll cost you on startup are well worth the dev and deployment convenience.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top