I am trying to find a way to uninstall a Drupal 8 module directly from database.

How can I achieve this?


You can use

  1. drush pm-uninstall.

  2. If you have entities in your module, write a query in your module to first delete all entities of your particular entity type. Once deleted, remove that file where you have written annotation for your entity, create a backup for use later. Except .info.yml file and .install file, remove all files.

Now you can easily un-install that module. Once un-installed, put all your backed up files into your module folder again, install your module and go!

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.