Skip to content

feat(env): clear the framework cache when the database it was built against changes - #1409

Merged
geodro merged 2 commits into
mainfrom
feat/clear-caches-after-a-connection-change
Aug 8, 2026
Merged

feat(env): clear the framework cache when the database it was built against changes#1409
geodro merged 2 commits into
mainfrom
feat/clear-caches-after-a-connection-change

Conversation

@geodro

@geodro geodro commented Aug 8, 2026

Copy link
Copy Markdown
Member

Repointing a site at another database left it serving errors. A framework caches the container definitions it builds from its configuration, and the cached ones survive the rewrite: after moving a Drupal site from its file database to MySQL, every request died with

PluginNotFoundException: "The "canvas_page" entity type does not exist."

while the connection lerd had written was correct, the module was enabled and present on disk, and drush could bootstrap against the new database perfectly well. Only the cache was wrong, and clearing it brought the site back.

A definition names the console subcommand that clears its caches, and lerd runs it through the console binary the definition already declares, the same way it generates an application key. Every framework spells it differently, cr for Drupal, cache:clear for Symfony, optimize:clear for Laravel, so nothing but the definition can say.

It runs only when the site actually moved database. The changed keys are matched against the ones the framework's own database services declare, so a rewritten URL or mail setting is not a reason to rebuild a cache, and a run that writes the same values as before clears nothing. A project whose dependencies are not installed has no cache to clear, and a failure is a warning rather than the end of the run.

The definitions have to name the command for this to do anything, which is a store change and not part of this.

Closes #1408

…gainst changes

Repointing a site at another database left it serving errors. A framework caches the container definitions it builds from its configuration, and the cached ones survive the rewrite: after moving a Drupal site from its file database to MySQL, every request died on an entity type the cached container no longer knew about, while the connection lerd had written was correct and drush could bootstrap against it perfectly well.

A definition names the console subcommand that clears its caches, and lerd runs it through the console binary the definition already declares, the same way it generates an application key. Every framework spells it differently, so nothing but the definition can say.

It runs only when the site actually moved database: the keys are matched against the ones the framework's database services declare, so a rewritten URL or mail setting changes nothing, and a run that writes the same values as before clears nothing. A project whose dependencies are not installed has no cache to clear, and a failure is a warning rather than the end of the run.
@geodro
geodro requested a review from a team as a code owner August 8, 2026 10:17
@geodro
geodro merged commit c9429cf into main Aug 8, 2026
3 checks passed
@geodro
geodro deleted the feat/clear-caches-after-a-connection-change branch August 8, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(env): a repointed database leaves the framework serving from a cache built against the old one

1 participant