Description
This appears to be an issue that is highlighted whilst using different versions of a module within source control, where there is a different version of a module in another branch.
When you update a module, and then switch branches to a branch with a lower version number, Magento throws an exception prompting the user to run bin/magento setup:upgrade.
\Magento\Framework\Module\DbVersionInfo::isModuleVersionEqual
appears to check for equality to current version number.
Running setup:upgrade
in this instance appears to do nothing.
I can't think of a reason why this has been done this way (I guess future versions of a module could update the database and then become incompatible with an earlier version?) - perhaps it's just the exception message that needs to change?
Preconditions
- Magento 2.1.7
Steps to reproduce
- Create a new module and give it a low version number
- Branch
- Update module with new installer, bump installer
- Run
bin/magento setup:upgrade
- Switch to original branch
Expected result
- Site to continue working
Actual result
- Exception thrown. Example below.
1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
xxxx_yyyy schema: current version - 0.7.0, required version - 0.5.0
xxxx_yyyy data: current version - 0.7.0, required version - 0.5.0
Exception #0 (Magento\Framework\Exception\LocalizedException): Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
xxxx_yyyy schema: current version - 0.7.0, required version - 0.5.0
xxxx_yyyy data: current version - 0.7.0, required version - 0.5.0
#0 /private/var/www/websiteabc/http/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#1 /private/var/www/websiteabc/http/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...')
#2 /private/var/www/websiteabc/http/vendor/magento/module-page-cache/Model/App/FrontController/VarnishPlugin.php(55): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#3 /private/var/www/websiteabc/http/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\PageCache\Model\App\FrontController\VarnishPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#4 /private/var/www/websiteabc/http/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...')
#5 /private/var/www/websiteabc/http/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(68): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#6 /private/var/www/websiteabc/http/vendor/magento/framework/Interception/Interceptor.php(142): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#7 /private/var/www/websiteabc/http/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#8 /private/var/www/websiteabc/http/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#9 /private/var/www/websiteabc/http/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#10 /private/var/www/websiteabc/http/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#11 {main}