using D8. I have a field field_number just in one bundle (a node content type that I called law). Now I found that I need to change the field type; it needs to be of type string and not integer.

I wonder if there is a quick/easy way of using migrate or something similar

I remember that time ago I used VBO in D7 but seems that the PHP option is not available in the D8 version of the module. Like in this case: https://drupal.stackexchange.com/a/28349/5422

I'll like to try using a hook_update_n on a custom module like in this example: How do I change a field type? but not sure if the the new field (as is created programatically) will be easily available for views and other modules and I don't want to end with a mess.


1 Answer 1


I ended up following this path. The reason I opened a new question was to see if there were any module or alternative to custom code.

My main concern was that the example was converting text to text and not number to text, but after executing some code using devel + webprofiler + kint (locally) I was able to see that even that same code was going to do the trick as the schema is affected only when needed.

For anyone looking at this same issue: take in mind that after running the custom code via the update process you will need some manual steps: recreate some views (when the field is used) and reconfigure the form display, presentation and so on of the bundles that are using the field.

As I have configuration of the site in git, my path was running the code locally, reconfigure the corresponding views, form displays, etc and then export the configuration, commit and push; then on production ran the upgrade and then import the config; it was pretty clean except that some views that have menu links assigned I had to manually edit its ordering.

Not the answer you're looking for? Browse other questions tagged or ask your own question.