Run updatedb before cache-rebuild on Drupal major upgrades - #62
Merged
Merged
Conversation
When deploying to TEST or LIVE, compare the Drupal major version of the incoming code with that of the database the target will end up with (LIVE's when --sync-content is used). If the code is a newer major, run drush updatedb right after env:deploy, since a new major version of core cannot rebuild its cache against the old schema. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Successfully tested on Pantheon: https://github.com/UCEAP/uceap-alumni/actions/runs/36432950092/job/108963527596#step:4:24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tl;dr there has never been a safe standard way to deploy drupal updates, every case remains a special snowflake
Problem
Deploying a Drupal 10 → 11 upgrade to TEST or LIVE fails. After
env:deploy,_pantheon_deployrunsdrush cache-rebuild, and a new major version of core can't rebuild its cache against the old database schema.drush updatedbhas to run first.Change
Before deploying,
_pantheon_deploynow compares two Drupal core versions fromdrush status --field=drupal-version:--sync-contentis used, because the sync copies LIVE's database onto TEST. Otherwise, the target's own database.If the incoming code is on a newer major version, the script runs
drush updatedb -yimmediately afterenv:deploy, beforecache-rebuildanddrush deploy. All other deploys behave as before.The only
env:clear-cache(which runsdrush cr) beforeupdatedbhappens beforeenv:deploy, so it runs against the old code.env:deployitself doesn't clear caches because we don't pass--cc.If either version lookup fails, the check reports no upgrade and the deploy runs the old way.
Testing
I ran
_pantheon_deploywith a stubbedterminus:updatedbrun early?--no-syncThis hasn't been run against real Pantheon environments yet.
🤖 Generated with Claude Code