magmatic wrote a reply+100 XP
2mos ago
magmatic started a new conversation+100 XP
2mos ago
I just deployed some changes to our live site (using Envoyer).
It included two migrations. The first one passed, and the second one failed. Since it failed, the new code was not going to be used. So we kept using the old code, but the first migration had already altered the database.
So the site went down because the old code couldn't use the new database structure (from the first migration).
We couldn't redeploy an old commit, because we were already using old code. And we couldn't go forward because that second migration would keep failing.
We don't like being in such a situation. It gives us anxiety. We receive alerts that the site is down. Our users yell at us. We're stuck. It's not recommended for our mental health. :(
Is there anything we can do about this?
It occurred to us that if we wrapped all migrations in a single transaction, even the first one would "roll back" if the second one failed. If we could do this, everything would continue to function, and we would be very very happy.
Any comments?