how to migrate drupal core to drupal recommended | switch from drupal/core to drupal/core-recommended | Upgrade drupal core 8.7 core to drupal recommended 8.9.19

As, Drupal 9 is bhooming, all website which is developed in drupal 7, drupal 8 are migrating in drupal 9.

So today, we will upgraded major version of drupal 8 which is 8.9.19 from drupal 8.7 or any drupal 8.X version.

In this this article we will also upgrade drupal core 8.7 core to drupal recommended 8.9.19

Related.

You can install new Drupal 9 site using composer with lando.

how to setup existing website with lando drupal 8

for more information you can visit drupal.org

Let’s start doing step by step.

Step 1: Before Upgrading you can check, install drupal version is 8.7.2

drupal core version is 8.7.2
drupal core version is 8.7.2

Step 2: run below command.

composer update

  In mycase, i am getting below error, if you will get same error, when manually remove it from composer.json file and run command again.

    – Root composer.json requires drupal-composer/drupal-scaffold ^2.5 -> satisfiable by drupal-composer/drupal-scaffold[2.5.0, …, 2.6.1].

    – drupal-composer/drupal-scaffold[2.5.0, …, 2.6.1] require composer-plugin-api ^1.0.0 -> found composer-plugin-api[2.1.0] but it does not match the constraint.

When, composer update will run successfully, you will get screen like below.

Step 3: run below commands, one by one.

composer remove webflo/drupal-core-strict --no-update
composer remove drupal/core --no-update
composer require 'composer/installers:^1.7' --no-update
rm composer.lock
rm -rf vendor
composer require drupal/core-recommended:^8.9 --update-with-dependencies
Drupal core to Drupal recommended
Drupal core to Drupal recommended

Step 4: run command: drush updb -y

Drush updb -y
Drush updb -y

In my case i’m getting below issue 1.

 [notice] Module indostar_custom has an entry in the system.schema key/value storage, but is missing from your site. <a href=”:url”>More information about this error</a>.

 [notice] Module labels_api has an entry in the system.schema key/value storage, but is missing from your site. <a href=”:url”>More information about this error</a>.

To Resolve this error, you will run below command.

lando drush php-eval "\Drupal::keyValue('system.schema')->delete('indostar_custom');"

lando drush php-eval "\Drupal::keyValue('system.schema')->delete('labels_api');"

In my case i’m getting below issue 2.

[error]  The “webform_rest_file_upload” plugin does not exist. Valid plugin IDs for Drupal\rest\Plugin\Type\ResourcePluginManager

To solve this issue, we need to update webform_rest module, and to update this module. run below command.

composer require drupal/webform_rest

added, below code in composer.json file under extra key. and run composer install command.

"patches": {
            "drupal/webform_rest": {
                "webform_rest": "https://www.drupal.org/files/issues/2021-04-30/webform_rest-add_file_upload_resource-2899902-37.patch"
            }
        },

Note: After fixing all isseus. Please run below commands

lando drush updb -y
lando drush cr
Upgraded drupal-core to Drupal-recommended latest version
Upgraded drupal-core to Drupal-recommended latest version

Step 5: found below issues, and fix it one by one, after upgradation.

ENTITY/FIELD DEFINITIONSMismatched entity and/or field definitionsThe following changes were detected in the entity type and field definitions.

Content

  • The node.field_event_time field needs to be updated.

Paragraph

  • The paragraph.field_blog_author field needs to be updated.

To Solve, this issues do below step.

Step 5.1 Install entity_update module from Drupal.org or run below commands.

composer require drupal/entity_update 
lando drush en entity_update
lando drush entity-update

Step 5.2 issues : FILE SYSTEMWritable (public download method)The directory sites/default/files/public does not exist. You may need to set the correct directory at the file system settings page or change the current directory’s permissions so that it is writable.

Solution.

Create public directory inside web/sites/default/files/ and folder path will be web/sites/default/files/public

Pradip Mehta

I am a well-organized professional in Drupal Development and PHP web development with strong script handling knowledge or automation process with PHP. I have advanced computer skills and am a proficient multitasker.