Skip to content

Run updatedb before cache-rebuild on Drupal major upgrades - #62

Merged
kurowski merged 1 commit into
mainfrom
d11-upgrade-updb
Sep 28, 2026
Merged

kurowski merged 1 commit into
mainfrom
d11-upgrade-updb

Conversation

@kurowski

@kurowski kurowski commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

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_deploy runs drush cache-rebuild, and a new major version of core can't rebuild its cache against the old database schema. drush updatedb has to run first.

Change

Before deploying, _pantheon_deploy now compares two Drupal core versions from drush status --field=drupal-version:

  • Incoming code: DEV for a TEST deploy, TEST for a LIVE deploy.
  • Database the target will have after the deploy: LIVE when --sync-content is 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 -y immediately after env:deploy, before cache-rebuild and drush deploy. All other deploys behave as before.

The only env:clear-cache (which runs drush cr) before updatedb happens before env:deploy, so it runs against the old code. env:deploy itself 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_deploy with a stubbed terminus:

Deploy Versions updatedb run early?
TEST, synced DEV 11, LIVE 10 yes
TEST, synced DEV 11, TEST 11, LIVE 10 yes
TEST, --no-sync DEV 11, TEST 11 no
LIVE TEST 11, LIVE 10 yes
LIVE TEST 11, LIVE 11 no
TEST, synced DEV 11.4.7, LIVE 11.4.6 no

This hasn't been run against real Pantheon environments yet.

🤖 Generated with Claude Code

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>
@kurowski
kurowski merged commit 5baf704 into main Sep 28, 2026
1 check passed
@kurowski
kurowski deleted the d11-upgrade-updb branch September 28, 2026 13:46
@kurowski

Copy link
Copy Markdown
Member Author

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.

1 participant