Magento2 InstallSchema add new column to existing table
First, I'm assuming when you say that nothing happens, you mean that the setup script runs as usual, but no errors are output and no changes were made to your database. If this isn't a correct assumption, please let me know!
When I do an upgrade to the schema, I don't do a getTable()
, I think that that is superfluous.
I tested the above script with that change, and it worked, so the two troubleshooting steps I would take are to:
- Ensure that you have incremented the
setup_version
in yourmodule.xml
(or your script won't run at all) - Add some obvious error in your upgrade script to see if it is running at all...if there is an error and the script is running, you will get error messages when running
setup:upgrade
I hope that helps!