Skip to main content

Working through and importing JSON data into a content type.

 

Drush migration commands

Check the status of the migration data

lando drush migrate-status

Reset the migration status 

lando drush migrate-reset-status  migratable_riverdata_json

Import JSON data

lando drush migrate-import migratable_riverdata_json

 

Rollback to before the import

lando drush migrate-rollback migratable_riverdata_json

 

Errors

What to do when a migration fails?  You will see a response similar to

lando drush migrate-import migratable_basic_content_json
 3/3 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
 [notice] Processed 3 items (0 created, 0 updated, 3 failed, 0 ignored) in 1.1 seconds (162.7/min) - done with 'migratable_basic_content_json'

In MigrateRunnerCommands.php line 458:

  migratable_basic_content_json migration: 3 failed.

The details in this are scant and offer no value.  To do so, you will need to get the migrate messages.

lando drush migrate:messages

If you have the following response

Not enough arguments (missing: "migrationId").

You are missing your id.  In the example above, I need to use migrate able_basic_content_json

lando drush migrate:messages migratable_basic_content_json

Response

 ------- --------------------------------------- ------------------- ------------------------------------------------------------------------
  Level   Source ID(s)                            Destination ID(s)   Message
 ------- --------------------------------------- ------------------- ------------------------------------------------------------------------
  1       Day 2 - Breakout session 3 livestream                       migratable_basic_content_json:field_tags:explode: NULL is not a string
  1       Subscription test                                           migratable_basic_content_json:field_tags:explode: NULL is not a string
  1       Subscription test - Media                                   migratable_basic_content_json:field_tags:explode: NULL is not a string
 ------- --------------------------------------- ------------------- ------------------------------------------------------------------------

Now we know what the issue is and where to focus attention.

Related articles

Andrew Fletcher07 Jan 2025
Resolving Twig syntax errors in Drupal
The release of Drupal 10.4.0 sees stricter validation rules being applied to Twig templates, which can result in unexpected errors after an upgrade. One such issue involves the use of regular expressions within Twig's matches operator, leading to syntax errors that can break template rendering.This...