1

I try to develop a D8 module with entities. A lot of them ^^. But there is an issue with the way D8 handles the creation of tables during the installation process. If the definition of the entities is not correct D8 can't create the table. But the module is enabled anyway.

Now D8 is not able to uninstall the module. I have tried drush pm-uninstall, drush cr, drush dre on the module. The uninstall process fails every time because D8 cant find the table and is obviously not aware of the failed installation of the module.

The only way I figured out was to create the tables with the primary key and then to uninstall the module. That works, but is very time consuming. How can I force uninstall my module even if the corresponding tables doesn't exist? And why is D8 ignoring the fact that the module was not installed correctly in the first place?

4

This is a known bug: https://www.drupal.org/node/2563515

As a workaround, remove the entity type definition (e.g. by removing the @ so it doesn't parse it as an annotation), clear cache, then uninstall.

  • Is there no way for Drupal Core to recognize the failed installation and then perform a rollback rather then enabling a broken module and (in worst case) make the whole site unaccessable? – Gaugolon May 10 '16 at 20:05
  • Recognize maybe, rollback is almost impossible. Mysql doesn't support transactions for things like created tables, so you can't reliably roll that back. And changes might have been made that outside of the database as well that can't be tracked. – Berdir May 10 '16 at 20:29
  • If you have a hook_entity_type_alter() in your module you may have to disable that (such as by changing the function name to not trigger the hook) before uninstall will work. – mlncn Jun 13 '16 at 12:20
0

You can uninstall the module from database from config.extension and remove blob there. I know that is very silly but till now we have this resolution.

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.