Magento 2.x – Update attribute type programmatically

If you need to update an attribute type programmatically, that you have done before (or not), you will need to proceed as follows, using an InstallData.php script in a custom module:

After that, remember to upgrade the version of your module in etc/module.xml and run the following commands:

Then, make a try and the field should be updated.!