Domanda

Evolutions is the default Play mechanism for DB schema upgrades.

If I push a play version to a Heroku setup that contains more than one web server - how does heroku know to run the evolutions only once?

In fact - a more general (related?) question - what is the startup order if I push a version to a setup with N web servers? Does Heroku start them one at a time?

È stato utile?

Soluzione

Documentation describes how it works. If you use Postgres or Oracle, the system can lock tables in a way that ensures only one server will run the evolutions.

If you use any other database you MUST disable evolutions in production, or you will have a lot of issues.

Heroku uses PostgreSQL by default (if you enable their DB) which means that is safe to deploy your app in multiple nodes at the same time with evolutions enabled, Play will take care of that.

If your application is running on several hosts, you must set the config property evolutions.use.locks=true. If this property is set, database locks are used to ensure that only one host applies any Evolutions.

Altri suggerimenti

I don't know much about Evolutions, but I assume this is a standard migrations tool in that it checks the current DB schema migration version and then runs outstanding migrations?

It so, even if this runs on app start, or whatever, and runs multiple times, only one of those processes will actually make changes?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top