What's the best approach to roll back an environment and keep the same id?

Hi everybody,

we are currently working on including migrations in our automatic build process. If these fail for some reason we want to rollback to the previous state.

To achieve this we clone the original environment before running the migrations. On failure we want to replace the original environment with the clone.

For the master this works fine. The alias comes in quite handy to switch between the original master and the clone.

But before we roll out these changes to master we also want to test our migrations on a develop and a test environment.

Since there are no aliases here I am looking for another way to replace the original environment with the clone. The problem here is that I need the same id after rolling back because our build process and the generation of the static pages rely on a specific environment id. I can’t just throw away the original environment and change the id of the clone to the original id. At least I didn’t find a way to change the id.

What would be the best way to rollback an environment and keep the same id?

Hi. I guess Contentful changed some stuff as for the Enterprise plan you can have custom aliases. This means you can use alias DEV with any number of other environments.

See Custom Alias in here