Simple problem PITA to fix.

I created a module with a custom entity and some other stuff. But there was an error during installation and the DB table did not get created.

Attempting to uninstall gives an error because it can't find the table to delete it.

 [ERROR] SQLSTATE[42S02]: Base table or view not found: 1146 
 Table 'xxxxx.zzzzz' doesn't exist:
 SELECT base_table.id AS id, base_table.id AS base_table_id                        
 FROM {zzzzz} base_table LIMIT 1 OFFSET 0; Array()

So I'm stuck - I've fixed the problem but can't uninstall the module to reinstall it.

How can I persuade the uninstall to work?

I have considered faking the table it's asking for, but is it going to expect the field tables to be there as well?

What I really need is for it to be less picky about the tables being missing.

  • 1
    This is one of the reasons, why you should have recent database dumps of your development environment before you are working on new features that might mess up/break your database. Commented Aug 23, 2018 at 7:41
  • 1
    Ha. Yes. Actually I do have a backup... (d'oh!) Commented Aug 23, 2018 at 8:15
  • But, carelessly, I had added it to another site (personal one) where I have the same problem but no backup. So I'll see if that other solution works too. Commented Aug 23, 2018 at 8:18
  • Yup, all good. it's worth mentioning that doing a cache clear followed by config export is probably wise. It'll add those comments over there. Note to self: Backups! Commented Aug 23, 2018 at 8:50


Browse other questions tagged or ask your own question.