I would like to explain our release management system for Magento 2 briefly. Then I am going to ask how to improve it.

We are using git flow for our release management. Our work flow is generally like the following:

  1. Create a new branch for a new feature
  2. Send a PR, and wait others to approve the PR
  3. Merge the feature branch with develop branch
  4. Test the feature on the develop branch
    • If tests don't fail then create a new release in git.
  5. Finally, use git checkout -f {RELEASE_TAG_NUMBER} to activate the new release.

As a result, we have a lot of release tags, such as 1.0, 1.2, ..., 3.41.

These steps are great if you did not change anything on the database. For example, we have updated a module in the latest version. If I rollback to previous one, then I got the following error message:

Magefan_LoginAsCustomer schema: current version - 2.1.3, required version - 2.1.1
Magefan_LoginAsCustomer data: current version - 2.1.3, required version - 2.1.1

It is happening because, Magento expects Magefan_LoginAsCustomer to be in version 2.3.1. The version in the code and database does not mach.

Question 1: When I rollback to previous version in code, how can I also roll-back the database?

This issue can get even worse with a change in database schema.

Question 2: Is there a way to roll-back code and database simultaneously?

Question 3: How do you manage your releases?

1 Answer 1


Right now, there is no way to do this, since there is no setup:downgrade command in order to downgrade the database schema in Magento.

The good news is that Magento is now building a new database upgrade system. With this system, you can downgrade and upgrade any module without worrying of database change. Magento will handle it behind the scene.

You can get more information in this link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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