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.
1 Answer
Just modify your setup file and add Upgrade Script. Don't forget to change the module version Step by Step :
- Add new attribute to Setup file (in my case Setup/ContactSetup.php)
- Add Upgrade Script (in my case Setup/UpgradeData.php)
- Change version number (etc/module.xml)
- Upgrade Module
php bin/magento setup:upgrade
- Clear Cache
php bin/magento cache:clean
AND DONE!!