Magento 2 – Development – Part 1b: Upgrade Magento 2.3.3 to 2.3.4
Upgrade Magento 2
All over the internet there are so many articles showing how to upgrade Magento 2 the quick and nasty way. In turn NOT the Magento 2 certified developer way. Even though however you update your Magento 2 instance, don’t take the “if it works it works” approach but try to conform to best practices.
Whats the Quick and dirty way.
The quick and dirty way is very simple is to go into the
composer.json file and looking for the require section, locating
magento/product-community-edition and changing the version number.
and once modified going to a terminal and executing the following:
This is normally perfectly acceptable BUT you don’t know of any issues until its to late.
Upgrade Magento 2.3.3 to Magento 2.3.4
The correct way to upgrade Magento 2 is to do the entire upgrade process via a terminal window using composer command line.
cp composer.json composer.json.bak composer remove magento/product-community-edition --no-update
First we remove the original Magento product from composer file. Why? Simply to make sure there re no issues
composer require magento/product-community-edition:2.3.4 --no-update
Then we re-require the product along with the newer version again not to update as we wish to update everything after.
At the composer update phase we shall know if there are any issues. But i got an error after reloading?
You will need to run the rest of the standard Magento commands for upgrading or installing as the database has likely changed.
bin/magento setup:upgrade bin/magento setup:di:compile bin/magento setup:static-content:deploy en_GB -f bin/magento c:f # c:f is short for cache:flush
Magento 2.3.3 Commerce to Magento Commerce 2.3.4
So whats the difference between upgrading magento 2 community edition and Magento 2 Commerce On premise edition. There is no real difference.
The process is exactly same all that is different is the package name.
cp composer.json composer.json.bak composer remove magento/project-enterprise-edition --no-update composer require magento/project-enterprise-edition:2.3.4 --no-update composer update
Magento 2 Commerce Cloud upgrade (starter and pro)
Magento 2 commerce cloud is slightly different though the principle is still the same once you have downloaded the project locally using:
magento-cloud login magento-cloud ssh-key:add magento-cloud get
We can follow the same process for upgrading the framework:
composer remove magento/magento-cloud-metapackage --no-update composer require magento/magento-cloud-metapackage=">=2.3.4 <2.3.5" --no-update composer update
You can see the main difference is its not a product but a meta package with a version defined different
>=new version .
Now that’s updated locally doing a simple git add and push to the server will deploy the new version to the current active branch, you will need to repeat this up the branches untill you reach both the staging branch and production branches.
git add -A git commit -m "upgrade magento 2" git push