Score:0

How to delete a no longer used custom bin table?

pe flag

I'm testing the cacheAPI with a custom bin. Everything is working. On the other hand, while testing, I created a custom bin with a name that does not suit me.

cache.lorem_bin:
  class: Drupal\Core\Cache\CacheBackendInterface
  tags:
    - { name: cache.bin }
  factory: ['@cache_factory', 'get']
  arguments: [lorem_bin]

A table in DB cache_lorem_bin was created.

So I modified it and another table was created with the name of this new custom bin. But the old table cache_lorem_bin was not deleted even after clearing the cache. I don't see in the documentation how to delete this table. It's not blocking but I would like to know how to do it.

Score:1
cn flag

Cache bin tables are automatically removed when you uninstall the module. You should have uninstalled the module before making the change and after that install the module again.

However, as a developer you can choose to drop the table manually to avoid the reinstall process. The new cache bin table will be created the first time it is used.

pe flag
Uninstalling the module did not delete the tables. I deleted them manually as you told me and everything is ok. I had quite a few and it's much cleaner.
4uk4 avatar
cn flag
You have to uninstall the old version before the change. It only deletes tables that are still defined in code.
pe flag
Thank you, indeed, that's right and it makes sense.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.