Magento – Magento 2.2.0 – Upgrade / Migrate from Magento 2.1.9 to Magento 2.2.0 with Sample Data

composermagento2magento2.2.0upgrade

Followed below commands to upgrade Magento 2.1.9 to 2.2.0 using terminal

1.

composer require magento/product-community-edition 2.2.0 --no-update

2.

composer require \
     magento/module-bundle-sample-data:100.2.* \
     magento/module-widget-sample-data:100.2.* \
     magento/module-theme-sample-data:100.2.* \
     magento/module-catalog-sample-data:100.2.* \
     magento/module-customer-sample-data:100.2.* \
     magento/module-cms-sample-data:100.2.* \
     magento/module-catalog-rule-sample-data: 100.2.* \
     magento/module-sales-rule-sample-data:100.2.* \
     magento/module-review-sample-data:100.2.* \
     magento/module-tax-sample-data:100.2.* \
     magento/module-sales-sample-data:100.2.* \
     magento/module-grouped-product-sample-data:100.2.* \
     magento/module-downloadable-sample-data:100.2.* \
     magento/module-msrp-sample-data:100.2.* \
     magento/module-configurable-sample-data:100.2.* \
     magento/module-product-links-sample-data:100.2.* \
     magento/module-wishlist-sample-data:100.2.* \
     magento/module-swatches-sample-data:100.2.* \
     magento/sample-data-media:100.2.* \
     magento/module-offline-shipping-sample-data:100.2.* --no-update 

3.

composer update

4.

php bin/magento setup:upgrade

composer.json after upgrade from 2.1.9 to 2.2.0

{
    "name": "magento/project-community-edition",
    "description": "eCommerce Platform for Growth (Community Edition)",
    "type": "project",
    "version": "2.1.9",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/product-community-edition": "2.2.0",
        "composer/composer": "@alpha",
        "magento/module-bundle-sample-data": "100.2.*",
        "magento/module-theme-sample-data": "100.2.*",
        "magento/module-catalog-sample-data": "100.2.*",
        "magento/module-cms-sample-data": "100.2.*",
        "magento/module-widget-sample-data": "100.2.*",
        "magento/module-tax-sample-data": "100.2.*",
        "magento/module-customer-sample-data": "100.2.*",
        "magento/module-catalog-rule-sample-data": "100.2.*",
        "magento/module-sales-rule-sample-data": "100.2.*",
        "magento/module-sales-sample-data": "100.2.*",
        "magento/module-grouped-product-sample-data": "100.2.*",
        "magento/module-downloadable-sample-data": "100.2.*",
        "magento/module-msrp-sample-data": "100.2.*",
        "magento/module-configurable-sample-data": "100.2.*",
        "magento/module-product-links-sample-data": "100.2.*",
        "magento/module-wishlist-sample-data": "100.2.*",
        "magento/module-review-sample-data": "100.2.*",
        "magento/module-swatches-sample-data": "100.2.*",
        "magento/sample-data-media": "100.2.*",
        "magento/module-offline-shipping-sample-data": "100.2.*"
    },
    "require-dev": {
        "phpunit/phpunit": "4.1.0",
        "squizlabs/php_codesniffer": "1.5.3",
        "phpmd/phpmd": "@stable",
        "pdepend/pdepend": "2.4.0",
        "fabpot/php-cs-fixer": "~1.2",
        "lusitanian/oauth": "~0.3 <=0.7.0",
        "sebastian/phpcpd": "2.0.0"
    },
    "config": {
        "use-include-path": true
    },
    "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/"
        },
        "psr-0": {
            "": "app/code/"
        },
        "files": [
            "app/etc/NonComposerComponentRegistration.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
            "Magento\\Tools\\": "dev/tools/Magento/Tools/",
            "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
            "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
            "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
        }
    },
    "minimum-stability": "alpha",
    "prefer-stable": true,
    "repositories": [
        {
            "type": "composer",
            "url": "https://repo.magento.com/"
        }
    ],
    "extra": {
        "magento-force": "override"
    }
}

composer.json after fresh installation of 2.2.0

{
    "name": "magento/project-community-edition",
    "description": "eCommerce Platform for Growth (Community Edition)",
    "type": "project",
    "version": "2.2.0",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/product-community-edition": "2.2.0",
        "composer/composer": "@alpha",
        "magento/module-bundle-sample-data": "100.2.*",
        "magento/module-catalog-sample-data": "100.2.*",
        "magento/module-customer-sample-data": "100.2.*",
        "magento/module-theme-sample-data": "100.2.*",
        "magento/module-widget-sample-data": "100.2.*",
        "magento/module-cms-sample-data": "100.2.*",
        "magento/module-review-sample-data": "100.2.*",
        "magento/module-tax-sample-data": "100.2.*",
        "magento/module-msrp-sample-data": "100.2.*",
        "magento/module-sales-sample-data": "100.2.*",
        "magento/module-catalog-rule-sample-data": "100.2.*",
        "magento/module-configurable-sample-data": "100.2.*",
        "magento/module-product-links-sample-data": "100.2.*",
        "magento/module-wishlist-sample-data": "100.2.*",
        "magento/module-sales-rule-sample-data": "100.2.*",
        "magento/module-downloadable-sample-data": "100.2.*",
        "magento/module-grouped-product-sample-data": "100.2.*",
        "magento/module-swatches-sample-data": "100.2.*",
        "magento/sample-data-media": "100.2.*",
        "magento/module-offline-shipping-sample-data": "100.2.*"
    },
    "require-dev": {
        "phpunit/phpunit": "~6.2.0",
        "squizlabs/php_codesniffer": "3.0.1",
        "phpmd/phpmd": "@stable",
        "pdepend/pdepend": "2.5.0",
        "friendsofphp/php-cs-fixer": "~2.1.1",
        "lusitanian/oauth": "~0.8.10",
        "sebastian/phpcpd": "2.0.4"
    },
    "autoload": {
        "psr-4": {
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/",
            "Magento\\": "app/code/Magento/"
        },
        "psr-0": {
            "": [
                "app/code/"
            ]
        },
        "files": [
            "app/etc/NonComposerComponentRegistration.php"
        ],
        "exclude-from-classmap": [
            "**/dev/**",
            "**/update/**",
            "**/Test/**"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
            "Magento\\Tools\\": "dev/tools/Magento/Tools/",
            "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/",
            "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
            "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/"
        }
    },
    "minimum-stability": "stable",
    "repositories": [
        {
            "type": "composer",
            "url": "https://repo.magento.com/"
        }
    ],
    "extra": {
        "magento-force": "override"
    }
}
  • Does the difference in both composer.json could create issues in
    future development ?

  • Is it advisable to upgrade or install fresh copy in case
    there is no real data except sample data ?

  • Is it advisable to upgrade or install fresh copy in case
    there is live data available ?

P.S. Upgrade process provides some clarity that what all things involved and we can prepare ourselves for future upgrade too. On the flip side, if we know the complete process and confident on the upgrade process then it's okay to uninstall and install the newer version. I am just brainstorming here so that we can take best route.

Best Answer

Process to update Magento 2.1 to 2.2:

For a full step by step instruction please refer to Upgrade Magento from 2.1 to 2.2.1 with sample data using composer (I created a new question because this one is specificly about "update vs. fresh install")

Answering your questions:

Does the difference in both composer.json could create issues in future development ?

Let's look at the diff:

"version": "2.2.0",

is the project version, which does not have any significance except that it tells you from which version you created the project. To avoid confusion I usually change that to the current Magento version during upgrade.

"require-dev": {
   [...]
}

is relevant if you use any of the dev tools listed there. For example, if you run PHPUnit tests, you should update the PHPUnit version accordingly, as the new test suite is updated for PHPUnit 6 and does not work anymore on PHPUnit 4

    "exclude-from-classmap": [
        "**/dev/**",
        "**/update/**",
        "**/Test/**"
    ]

is an optimization for the autoloader. It makes sense to copy it to your composer.json but nothing should break if you don't.

"minimum-stability": "stable",

is the default stability requirement for dependencies. It looks like you changed it to alpha for some reason, so that's up to you.

Is it advisable to upgrade or install fresh copy in case there is no real data except sample data ?

In that case, and if you did not install any extensions, it's easier to install a fresh copy (i.e. overwrite composer.json and run composer update) because you can be sure that you don't miss anything and there are less manual steps.

Is it advisable to upgrade or install fresh copy in case there is live data available ?

With only live data it's the same as above, but if you installed any extensions, I'd rather update composer.json manually with changes from the latest version.