I'm following the guide from Magento DevDocs about the Declarative Schema

I created a new module with old setup way (InstallSchema.php, InstallData.php) to test the convert install/upgrade schema scripts to db_schema.xml config. I ran two commands:

bin/magento setup:install --convert-old-scripts=1
bin/magento setup:upgrade --convert-old-scripts=1

But, I didn't see the db_schema.xml in my custom module. Why the db_schema.xml didn't generate in my module?

I also see the note from Magento

The Schema Listener tool listens for schema changes and attempts to change Magento code, so it should not be run in production mode. It is disabled by default.

So, what should I do in my case? My app is in developer mode.


After writing my question. I found my issue: I had run the setup upgrade command before.

So, I removed my module from setup_module table and my custom data table. Then I ran the two commands again.

bin/magento setup:install --convert-old-scripts=1
bin/magento setup:upgrade --convert-old-scripts=1
  • which commands? – Mohit Rane Aug 8 '19 at 10:17
  • php bin/magento setup:upgrade. It's our "common" command. But, before that, we need to remove module from setup_module. @MohitRane – Khoa TruongDinh Aug 8 '19 at 10:44
  • okay, Thanks for the reply. – Mohit Rane Aug 8 '19 at 10:51
  • Didn't work for me. I removed from setup_module and also deleted the table second time. Didn't work at all. :( – Damodar Bashyal Sep 1 '20 at 7:44

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.