I am working on a custom module with EAV attributes / models. I have added some attribute in my setup script and the module is installed and working. Now as the requirement changed, I need to add a new attribute in my script. How can i write and upgrade script for the same.


Just modify your setup file and add Upgrade Script. Don't forget to change the module version Step by Step :

  1. Add new attribute to Setup file (in my case Setup/ContactSetup.php)
  2. Add Upgrade Script (in my case Setup/UpgradeData.php)
  3. Change version number (etc/module.xml)
  4. Upgrade Module php bin/magento setup:upgrade
  5. Clear Cache php bin/magento cache:clean


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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