Migration Process from Drupal 7 to 8

Drupal provides support for D7 to D8 migrations. Since there is no direct upgrade path for Drupal 7 to Drupal 8, we should follow the migration system in Drupal by which we can migrate content & configuration from Drupal 7 to Drupal 8.

Pre-Upgrade Checklist

When we will start with the migration process. Then we should go through the following checklist to ensure to check off all the mentioned items:

Migration Modules

Drupal 8 core comes with the following migration modules:

  • Migrate: Drupal core upgrade API module.

  • Migrate Drupal: This module consists of all the classes that are required for migration/upgrade from Drupal 7 to Drupal 8.

  • Migrate Drupal UI: This is the module that provides the user with a simple and easy to use UI for performing the migration from Drupal 7 to Drupal 8.

Potential Migration Problems

You might face two problems during the migration/upgrade process:

  1. Missing migration paths

  2. Contributed modules might not migrate properly to Drupal 8

Migration issue Drupal 7 to Drupal 8

There are few issues that come while migrating the UCSB D7 to D8.

Error: Exception thrown while clearing the site cache (Do it through Performance / Drush command) Refer error in the screenshot.

This issue can be resolved after truncated all cache table with the connected database by using the below-mentioned queries:

TRUNCATE TABLE cache; TRUNCATE TABLE cache_block; TRUNCATE TABLE cache_bootstrap; TRUNCATE TABLE cache_field; TRUNCATE TABLE cache_filter; TRUNCATE TABLE cache_form; TRUNCATE TABLE cache_image; TRUNCATE TABLE cache_menu; TRUNCATE TABLE cache_page; TRUNCATE TABLE cache_path; TRUNCATE TABLE cache_token; TRUNCATE TABLE cache_update;

After that, another error has been come up which is the system-specific.
Error: permission issue that can be resolved by giving 777 permission to the directory which is showing in error log.

 

There are two different ways to migrate from Drupal 7 site to Drupal 8.

  1. Migration through Drupal Configuration.

  2. Migration Using Drush Command & Composer.

1): Migration through Drupal Configuration

Steps to Migrate Drupal 7 To Drupal 8 Using Site Configuration of Drupal

Step 1: Back-up of Old D7 Website

Start the migration process by making a local copy of your website. Making changes to the live site is not recommended, it is a best practice to keep all data safe by taking a backup locally on your machine.

Step 2: Install New D8 Website

Install the latest version of Drupal 8 along with installing dependencies.

Step 4: Enabled Core Modules

Ensure Migrate, Migrate Drupal, and Migrate Drupal UI modules are enabled on your Drupal 8 site. This can be done by navigating to the 'Extend' tab of your website and ensuring all the above modules are present in the core. 

Step 5: Upgrade Website D7 to D8

To start upgrading the website put /upgrade (www.<yourwebsitename>.com/upgrade) after the site domain name and follow the instructions which will appear to the screen for the next step. Now click ‘Continue’ button.

Step 6: Enter D7 database connection details

After ‘Continue’ new screen comes up which will ask you for the website database connections details and file path.

 

Step 7: Start the migration

If the database credentials to your source database are correct, the upgrade review page will appear on the Migrate UI. It will show the summary of the upgrade status for all installed modules on the old site.

If you manually create a node to the Drupal 8 site before upgrading and the source Drupal 6/7 site has a node with the same ID, the migration system will overwrite the node that was manually created in Drupal 8.

If conflicting IDs are detected, a warning about conflicting IDs will be shown which can be ignored to risk losing data or abort and take an alternative approach.

Migrate UI Summary:

If you are reviewing the migrate review page that will show the to module those can be migrated from D7 to D8 (Migration process will not automatically install the module which is uninstalled in drupal 8. So make sure that install the module in Drupal 8 while migration.)

Module will not be upgraded: This will have the list of all module which haven’t be migrated from D7 to D8 and by this list make sure that module has been installed and configured on D8 site. Once you will do that then count will be decreased from this list.
Checklist and screenshot here

We are facing issue while migrating the files from D7 to D8 and the issue came because there are few contents is having .yml extension files which are not importing along with content the content. So we have to use 2 contributed Module and configured listed as below

After making this configuration we are able to import files from D7 to D8.

 

2): Migration Using Drush Command & Composer

Upgrading to Drupal 8 using Drush is useful when migrating complex sites as it allows you to run migrations one by one and it allows rollbacks.

If you are using Composer to build your Drupal 8 site, then you may already have Drush installed.

Required contributed modules for Migration using Drush Command

·       Migrate Upgrade: Provides Drush support for upgrading from Drupal 7 to Drupal 8.

·       Migrate Plus: Provides extensions to core migration framework functionality.

·       Migrate Tools: Provides Drush commands which can be used in the migration process.

Ensure the Drush is up to date

Command:-

drush –version

Now start your migration with following Drush command

Command:-

drush ://user:password@server/db -- ://example.com --configure-only

Replace below mention value with your values in the above command

-'user' is the username of the source database

-'password' is the source database user's password

-'server' is the source database server

-'db' is the source database

To check the migration list, please use the following command

Command:-

After migration, check migration status with the following command

Command:-

Security updates:

If newly released for a security update. Then we will need to implement the security updates to keep your site secure.

There are different ways to check for security releases:
Under the administrative panel, Reports > Available updates > Settings or admin will be notified when updates are available.

Drupal core update via Drush:

Steps to update Drupal core using Drush 8.x. Drush by using Drupal Shell--the command line interface for Drupal.

1: Take backup of both files and database. Using Drush, type in, and execute this command.


2: Check for available updates by using the command.


3: Then enable maintenance mode by using the commend.


4: Clear the cache by using below command.


5: There are various options to execute the updates. We can choose depends on what type of update(s) are required.

5.1: Update Drupal core


5.2: Update Drupal core to a development branch, for testing and patch creation only (not Production)


5.3: Update a single module.


5.4: Update only security updates

6: Reapply any core patches you were using before the upgrade.


7: Update database, if any required database updates are needed

8: Deactivate maintenance mode


9: Clear the cache again

Drupal core update Steps:

The Drupal core can be updated by administrative interface or by using Drush Commands.

  1. take the complete backup of the site.

  2. Cache needs to be Disable if any caching technique (Memcache, varnish, and so on) has been used.

  3. Put the site on maintenance mode.

  4. Download the latest version zip archive of Drupal 8.x core from Drupal.org Drupal Core Downloads.

  5. Upload the archive file to the server.

  6. Extract the core file to a temp directory on the server.

  7. After that, Delete the core and vendor directories, and all files that are not in a subdirectory, including .htaccess, composer.json, and autoload.php. Don’t delete custom and customized files because you may end up losing the custom functionality stored in them.

  8. Copy the core and vendor directories and the non-custom/non-customized files that you deleted in the preceding step from the temporary directory to your site directory

  9. Once you are done with the core update part the run Domain_name/update.php in your browser.

  10. If you get any error or warning, re-run the update.php script again till all the updates have been completed successfully.

  11. Return to the administration section of your site.

  12. Take the site out from maintenance mode.

  13. Clear the cache

  14. Re-enable any caching technique you disabled at Step 2.

Drupal Modules Update

If we are updating a contributed module and run the Database updates script. then the below-mentioned process needs to be followed.

Modules Update Steps:

Firstly, Check all module-specific requirements before proceeding with the updates. To find these instructions, you can check the module’s project page Read Documentation link.Unzip the file and look for README.txt, INSTALL.txt, and UPGRADE.txt.

Administrative interface to update a contributed module.

  1. Put your site in maintenance mode. See Section 11.2, “Enabling and Disabling Maintenance Mode”.

  2. In the Manage administrative menu, navigate to Reports > Available updates > Update (admin/reports/updates/update).

  3. Find and check the module in the list.

     

  4. Click Run database updates. If you obtained the new module files manually, start with this step, and reach the database updates page by typing the URL Domain_name/update.php in your browser.

  5. Click Continue and apply all updates. The database update scripts will be executed.

  6. Click Administration pages to return to the administration section of your site.

  7. Take your site out of maintenance mode.

  8. Clear the cache.