-4

I am working on Magento-2.2.4. I have installed the no.of extensions which are supported to Magento-2.2 version by copying directly the zip files into server.

Some of the extensions are not working. So that, I have deleted the extension folder from my app directory.

When i run php bin/magento setup:upgrade command, The database tables of the all extensions were created. Now, i deleted some extensions. But, the deleted extension's database tables are there in my database.

How to clear those all deleted extension's tables from database?

4
  1. You should manually delete entries of extension/module from the table called setup_module in the database.
  2. By the way, it's not a good way to directly delete module. instead, disable the module. if the extension was added using composer you can uninstall using composer.
  3. You should delete entry of module from setup_module table
  4. you cant uninstall if you haven't installed by composer
2
  • Then you should delete entry of module from setup_module table – Bhakti Thakkar Sep 7 '18 at 17:00
  • you cant uninstall if you haven't installed by composer – Bhakti Thakkar Sep 10 '18 at 7:02
1

Try

php bin/magento module:disable Module_Name
1

If a module was installed with php composer.phar require ... then you can try Magento's command php magento module:uninstall namespace_module --remove-data as described on the official documentation. This also has some options for backing up those tables, in case you need them later. This only will remove the tables if the module has an Uninstall script.

If the module doesn't have an uninstall script or if its a module you have in app/code, then there unfortunately isn't any magic script. You will have to remove any tables you don't want manually. You'll have to look at each modules Setup folder for InstallSchema.php and UpgradeSchema.php and find instances of the newTable or createTable functions.

This regex should find where tables are installed in Magento setup scripts:

.*newTable\((?:\n|\r|\n\r).*->getTable\((?:\'|\")(.*)(?:\'|\")\)

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.