Given the scenario:

 an update to a module is deployed and immediately results in breaking the checkout

The expected reaction could be to rollback the deployment. However, with the way magento 2 handles module versioning (if a module's schema or setup version was altered during deployment and setup:upgrade was ran) this would result in an error requiring your module to match version listed in the setup_module table.

The only way I know how to resolve this error would be to either change the module version to match the db version after rolling back the deployment or to manually alter the module version number in the db back to its previous version after the rollback.

I am wondering

  1. Why the magento team decided to have magento throw an error if the module setup or schema version does not match the version in the db?
  2. What is the rollback strategy magento recommends given such a scenario?

...a warning in the logs would seem to be a better option to me rather than throwing a fatal error and forcing downtime.


You should always pre-build your production site before sending the build to your production server. This will ensure that your items are tested and working and you don't have to run a number of build commands on the production box.

If you do encounter errors, in this case, you should be ready to roll back your code and your database. (This is where having a good UAT plan in place pay off!)

So your basic deployment procedure would be like the following:

Commit to master(Production) branch -> push to build server (maybe staging) -> complete build and test -> tar build and commit to artifact repo for deployment -> deploy to production server(s)

You final deployment will include all items needed to ensure your already build version of Magento will be running in production.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.