I created and installed my database via the InstallSchema.php file. I now need to add a new column to one of my tables. In order to get the new column added to the table I deleted the module name entry from the setup_module table. I made my changes to to the InstallSchema.php file to add the additional column. Then I run the command "php bin/magento setup:upgrade" but the database is not being updated with the new column. Below is the code for the new column I am trying to add.

                ['nullable' => false, 'default' => 0],
                'API Status'
  • you have to add in UpgradeSchema.php file and change the version in module.xml
    – Vishnunath
    Commented Nov 13, 2019 at 19:27

2 Answers 2


You should use UpgradeSchema for this, but if you don't care about the data in the existing table and just want a quick fix, delete the existing table, remove the row from setup_module, clear cache, and run setup:upgrade and your custom table should be created with your new column.


From Magento 2.3 it is recommend to use declarative schema. https://devdocs.magento.com/guides/v2.3/extension-dev-guide/declarative-schema/db-schema.html Try to replace old install scripts with declarative schema.

Please check this tutorials: https://www.mage2.tv/content/fundamentals/declarative-schema/ - Vinai Kopp explanation for declarative schema. https://inchoo.net/magento-2/declarative-schema/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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