Blogs

EMAIL: info@example.com

undpaul: Using Migrate as a replacement for Update Hooks

As a developer I tend to be lazy. I’m always searching for tools or shortcuts to make my live more comfortable. Recently I stumbled across a tweet by drubb giving an example on how to use migrate instead of a custom update script to update existing entities. Having no use for it at this time I saved it in my “maybe useful later”-part of my brain … and forgot about it.

However, last week I had to add an existing field to the form display of all Paragraphs bundles in a project. Additionally a new field should be added and configured. Because I didn’t want to configure the fields manually (remember? I’m a lazy developer!) for all Paragraphs bundles (there are about 80 of them in this project) I normally would have written an update hook for this task. But then I remembered the tweet and thought “wouldn’t it be also possible to update the configuration using migrate?”.