[Site Upgrade] Merging the Blog Content Types
Since I'm working my site's upgrade in background, I decided that I'd handle as many of the data changes in the current Drupal 8 instance as possible to both stop the bleeding and try to reduce the need for a large data migration. As I mentioned in my previous post, I had a few different flavors of blog posts spread across 5 different content types. Merging them together was relatively simple. At first I was planning on writing code to handle the work but I found contributed modules that could do the job. Disclaimer, I did this in a sandbox, do not try this in a live environment.
Here's what I did:
- Added functionality so notes can optionally use titles.
- Added a flag to the Note content type to indicate whether the title should be persistent and used.
- Updated my call to hook_node_presave in a custom module to only autogenerate the title if the flag is not set.
- Updated the twig templates to display titles if the flag is set.
- I added a source field to the note content type in case I need it for the future.
- Merge category taxonomy vocabularies
- Each blog type had its own separate category field and its own unique vocabulary. I used the Taxonomy Manager module to move terms into a single vocabulary.
- Converted content from each content type into note
- I used the Convert Bundles modules to do the heavy lifting.
- The mapping tool worked perfectly.
- I merged them a content type at a time populating the source based on the feed.
- I used the Convert Bundles modules to do the heavy lifting.
All this worked perfectly and this site now has 1 blog content type, Notes. When it's time to move this to Drupal 9, I'll probably rename the content type to Blog Posts.