Ordering Play Evolutions on Multiple Databases
Asked Answered
V

1

9

I've got an environment where I'm using multiple databases (A and B) with different sets of evolutions for each, thusfar completely successfully. However, one set of database evolutions always gets applied first, all the evolutions for B database are applied before any of the evolutions for A database.

We're doing some major restructuring and this results in some cross-database querying to move database B into the future, but because the evolutions for database B run first, the changes to database A haven't taken place yet and the evolution fails.

Is there any way to change/prioritize the order in which database evolutions are applied between multiple databases using different sets of evolutions?

Valona answered 11/2, 2014 at 0:51 Comment(1)
is that possible to turn on the database you want to apply evolution first, and turn off the other one ?Encircle
G
0

Unfortunately I don't think there is a way to do this at the moment. Play simply iterates over the databases and runs the evolutions for each of them:

    dbApi.databases().foreach(runEvolutions)

The databases sequence comes from the configuration Map so there's no way for you to guarantee the order in which it is read.

I think your best option would be to run the evolutions in multiple steps without making breaking changes between each step. After the migration is done you make another evolution to cleanup the moved columns/tables.

Greggrega answered 17/4, 2016 at 20:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.