I suspect that will be challenging to build:
- some migrations are irreversible
- many migrations are stored within plugins that won’t be there if they are not installed, so there is nothing to reverse.
But try to build it and see if you can overcome those issues.