Magento Setup script Uninstall
From the previous part here we’ll continue with the Mage Module uninstall script. Likewise other Magento setup script, uninstall script is very handy and useful to remove data from DB.
Here I wish i could write some simple step step by user manual for Mage Module scripts. But unfortunately the process is as complex it seems. And it is much more efficient to hire a developer to do the job for you rather you’re a honorable client of Aspiration Hosting. Because we’re providing 100% free web development and support to our clients whom using our Mage SSD storage hosting plans. Also enjoy lightening loading speed keeping the LightMageCache behind with super fast CDN service. Even our basic plan supports all of these premium features in very minimum cost USD 7.99 per month only.
Tanzia Farin Chy for Aspiration Hosting
Magento setup script – Uninstall
As we already know that Mage 2 also have some uninstall script too!! And the uninstall script is very handy in case we want to remove some tables, columns or data from the root or DB. Hence the uninstall script sweep such a way that the data was not even exist in server site.
In comparison uninstalling is quite different action than disabling. In most cases all of Mage 2 extension should have the uninstall script which is a good practice and suggested. Basically it’ll help to maintain a clean DB without the unwanted extensions. Also it is very useful to clean some specific data from DB tables.
Though today there no such Uninstall scripts whom are available in core modules to test. But regardless of that the pattern is identical.
The Magento setup script for Uninstalling is following:
namespace Aspiration\SetupTest\Setup;
use Magento\Framework\Setup\UninstallInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;
class Uninstall implements UninstallInterface
{
public function uninstall(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
//uninstall code goes here; call table …
$setup->endSetup();
}
}
Here Make a note these script only works with modules installed using Composer.
Now reading Part 02 | Part 01