🛣 No Way Back or Life Without Rollback
I recently started trying to work with a new, but very ambitious ORM drizzle.
And I stumbled upon a thread discussing that drizzle only generates up migrations. People started complaining that they don't have down migrations, which means they can't rollback.
The author's response made me think a lot: he says that in general, he has never needed to and it's often much more complicated and incorrect to rollback, because all changes (including fixes) should be applied on top.
That is, even if you want to make a rollback, it should be a separate up migration.
And you know, I agree with him.
Most often, to be able to really make a rollback if an error occurs, we have to prepare a lot of things (starting with the codebase and ending with a lot of features in CI/CD pipelines), while in practice, I remember single cases when it helped without breaking the application and the database.
In 95% of cases, if the deployment was broken or the wrong version was released, we simply applied fixes on top, rather than rolling back.
It's easier than implementing a rollback, safer, and at the same time extremely effective.
So, my advice is to invest your efforts in creating conditions for quick fixes during a problematic rollout, rather than rolling back the deployment.
Everyone, powerful pumping 🦾