user7876637
user7876637

Reputation: 154

Automatic Ecto migrations with multiple VMs?

I have N worker processes (not Erlang PIDs) in different Erlang VM instances that need access to the same Postgres database, where N >= 2. When these workers are upgraded, I want to be able to run Ecto migrations automatically, so that when I roll out an upgrade of these workers, I don't have to go through the dance of "stop all workers, run migration, start all workers again" if at all possible. However, when thinking on it, the only solutions I can come up with are:

But all these solutions feel like hacks around the problem. Either I'm missing here, or I'm just thinking about migrations the wrong way, and I'm not sure which of these is true.

Upvotes: 0

Views: 109

Answers (1)

José Valim
José Valim

Reputation: 51349

Have another worker specifically to only do migrations. This is the path I'm likely going to end up using.

This seems like the best way to go for now. Although note that Ecto 3.0, currently in development in master, will use locks when running migrations, so this problem will be solved for you.

Upvotes: 1

Related Questions