Migration of Files from Dupal 7 to Drupal 8 with: [notice] Field discovery failed for Drupal core version 7. Did this site have the CCK or Field module installed? Error: No database connection configured for source plugin d7_field_instance

When migrating files in Drupal 7 to Drupal 8 you receive one or more notices:

[notice] Field discovery failed for Drupal core version 7. Did this site have the CCK or Field module installed? Error: No database connection configured for source plugin d7_field_instance

At the end of the migration you will see something like this:

[notice] Processed 2607 items (2474 created, 0 updated, 15 failed, 118 ignored) - done with 'file'

The numbers will be different according to the amount of files you are migrating. In my case each of the 118 ignored files all had generated [notice] Field discovery failed....

After looking through the database I found that one of my fields held reference data to a user that no longer existed.

Process I took to find the problem

  1. Google and Drupal site
    1. There was very little information to be found with searching for: [notice] Field discovery failed for Drupal core version 7. Did this site have the CCK or Field module installed? Error: No database connection configured for source plugin d7_field_instance.
  2. Dive into the database – splash
    1. Find which files didn’t get migrated from the migration map with MYSQL on the D8 database.
      SELECT * FROM `migrate_map_file` where source_row_status <> 0;
      
      You’ll want to note that all the files that don’t have a d8_database > migrate_map_file > migrate_map_status of 0 are not created. The status of 2 means the file is ignored and 3 means it failed the migration.
    2. Use MYSQL on the D7 database to select a few files each that were ignored and created.
      SELECT * FROM `file_managed` WHERE fid = 5981 OR fid = 6051 OR fid = 5816 OR fid = 6906 OR fid = 16231 OR fid = 3709
      
      The file_managed table is where you can pull each FID (field id) from the fid column. In the example the last two FIDs where files that were created. The other 3 FIDs where ones that had been ignored. By comparing these I found that the only thing that stood out was the UIDs (user ids). A couple of the files ignored had the same UID.
    3. On the Drupal 7 site I viewed the user by the UID (mysite.com/user/123). This ended up in a page not found. You can also check this in the database with the following command.
      SELECT * FROM `users` WHERE uid = 123;
      

Conclusion

There were files with an author that no longer existed in the database. As an example, the file with the FID of 5981. This file referenced the author, which was a user, with a UID of 123 that was no longer in the database. This caused the notice and for the file to be ignored in the migration.

Posted in Drupal 7 to Drupal 8 Migration, Drupal 8 and tagged , , , , .