Upgrade script when you don't know which version they have
-
16-10-2019 - |
Question
I know how to do upgrade scripts within Magento but the current way relies on me knowing the version the user is running.
If I have some users running v0.2 and some 0.3 but I want to make a change for anyone who moves onto 0.5 how I would I go about that?
I currently have:
mysql4-install-0.2.0.php
My new version will be 0.5.0
but some users are running 0.4.6
and some are running 0.4.9
.
Do I have to create an upgrade script for each of the versions users might be using? i.e
mysql4-upgrade-0.4.6-0.5.0.php
mysql4-upgrade-0.4.9-0.5.0.php
Solution
You only have to create the 0.4.9 - 0.5.0 script. Magento will automatically pickup the skip in version numbers.
OTHER TIPS
You can create a few upgrade-scripts. like:
upgrade-0.2.0-0.5.0.php
upgrade-0.3.0-0.5.0.php
and put different thing in them, depending what happend in version 0.3.0
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange