Migration Mess

Submitted by Marc on Sun, 06/17/2018 - 14:44

When I set out to learn Drupal 8, I wanted to do things in the recommended ways - of course! So, when I ran into the challenge of importing items into Drupal, I got a little stuck. In Drupal 7, I've used the Feeds module for MANY uses and it's worked very well. When it came time for D8, however, it seemed as though Feeds hasn't really been a big focus in favor of the core module, Migrate. So, I dove headfirst into the new migrate API and started writing code. My goal was fairly simple - to import a JSON feed to nodes. However, I didn't want to import all of the items - only the ones that changed. Oh, and I didn't want to update things like the title of the node, only specific fields. I did have a GUID (like Feeds). Unfortunately, I had to go down some rather lengthy rabbit holes and hit many dead ends.

The problem wasn't necessarily the API - In general it sets some good presidents and I like the idea of the "source", "destination" and "process" plugins that you can use (or write your own). The problem was more along the lines of poor documentation - The API itself isn't well documented to begin with. And the many articles I found from around the web from other developers oddly varied widely in the use of the API. Some posts highly recommended using Migrate Plus, others said don't use it at all because it added too much complexity. Either way, the documentation and code samples also varied wildly - YML files were all over the map. In the end, I was able to get the JSON feed to be recognized, but, it required titles to be updated - something that I didn't need - and I sort of lost it. I had spent so long in research / test mode, I just gave up.

I'm sure I could have continued down the path and made migrate work for me, and perhaps I will in the future. The complexity of writing my own custom migrate plugins, YML files, and the research were driving me a little batty. I've decided to roll my own Drupal service that runs every hour on cron to update fields. The nice thing is, I'm able to control every step of the process including watchdog messages and revision log messages per node.