How to drop a table in Magento 2.3.0 using declarative schema ?

  • what happens if you completely remove the table from the db_schema.xml file?
    – Marius
    Jan 9, 2019 at 9:04

2 Answers 2


Please follow below steps for drop table using db_schema.xml in Magento 2.3.X

1) Disable table

First of all, you need to add disabled="true" attribute in your table node.

<table name="abcd" resource="default" engine="innodb" comment="Table" disabled="true">

2) Set blank table node

Remove all nodes in between table

<table name="abcd" resource="default" engine="innodb" comment="Table" disabled="true">


3) Run commands

If you want to remove table so you must generate/update db_schema_whitelist.json in your module so please run below command before setup upgrade

1) php bin/magento setup:db-declaration:generate-whitelist --module-name=[Vendor_Module]

2) php bin/magento setup:upgrade
  • thanks, you saved my time :) Apr 3, 2020 at 12:00
  • WARNING: although being the right way of doing this, the disabled=true will NOT work if the original third-party module uses an InstallSchema.php script instead of the db_schema.xml new convention Aug 12, 2022 at 14:28

If you want to drop table, then you can either remove entire table node from xml file or you can set disabled attribute to true as like below line in your db_schema.xml :

<table name="rh_helloworld" resource="default" engine="innodb" comment="RH Helloworld" disabled="true">


  • 2
    I have checked its not working. Gettign Error: Element 'table', attribute 'disabled': The attribute 'disabled' is not allowed. Line: 5 Verify the XML and try again. Jan 9, 2019 at 12:09

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.