Hi everyone, Today I will guide you how to drop table in Magento 2 using declarative schema.
Step 1. Create file app/code/Magepow/DeclarativeSchema/etc/db_schema.xml with content bellow:
<?xml version="1.0"?
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="magepow_declaration_schema_new" resource="default" engine="innodb" comment="Magepow DeclarativeSchema" disabled="true" />
</schema>
Just remove all the columns line from <table> tags and add disabled=”true” attribute in <table> tag.
<table name="magepow_declaration_schema_new" resource="default" engine="innodb" comment="Magepow DeclarativeSchema" disabled="true" />
Now, you just need to upgrade your setup by running following command.
php bin/magento setup:upgrade
Then go to your database and check, your table will not be there after running setup upgrade command.
Done, Hope this article will helpful for you.