Skip to content

Run database updates before any cache rebuild on TEST/LIVE deploys - #64

Draft
kurowski wants to merge 1 commit into
mainfrom
deploy-updb-before-cache-rebuild
Draft

kurowski wants to merge 1 commit into
mainfrom
deploy-updb-before-cache-rebuild

Conversation

@kurowski

Copy link
Copy Markdown
Member

Problem

Deploy to TEST for ucdcweb2 failed after a Drupal core upgrade from 11.1.10 to 11.4.11:

terminus drush -- cache-rebuild
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'alias' in 'INSERT INTO'

_pantheon_complete_deployment runs cache-rebuild before drush deploy. Against LIVE's synced database, the new core rebuilt the router before its update hook had added the router.alias column. The deploy then stopped with TEST still in maintenance mode.

1780e49 and f0a549d already handled this, but only for major upgrades. Minor releases change the schema too.

Change

drush deploy already runs updatedb, then config:import, then cache:rebuild, so nothing needs to rebuild caches before it. This PR removes:

  • the cache-rebuild before drush deploy
  • the env:clear-cache before env:deploy, which fails the same way when an earlier deploy stalled with new code on the old schema (the cache clear at the end still runs)
  • _drupal_major_upgrade_pending and the extra updatedb, which only worked around the two calls above

The TEST/LIVE deploy is now: maintenance on → env:deploy → drush deploy → maintenance off → env:clear-cache. The training deploy also calls _pantheon_complete_deployment and gets the same fix.

Testing

Only bash -n has been run so far. To verify: after this image is published, run a normal (sync) Deploy to TEST on ucdcweb2. LIVE is still on 11.1, so this reproduces the original failure and should now pass. Do this before ucdcweb2 deploys to LIVE.

🤖 Generated with Claude Code

Deploying ucdcweb2 to TEST failed after a Drupal core upgrade from 11.1
to 11.4: cache-rebuild ran before drush deploy, so the new core code
rebuilt its router against the live database's old schema and hit
"Unknown column 'alias'". The earlier fix only covered major upgrades,
but minor releases change the schema too.

drush deploy already runs updatedb before config:import and
cache:rebuild, so drop the cache-rebuild in front of it, the pre-deploy
env:clear-cache (which fails the same way after a stalled deploy), and
the major-version detection that only existed to work around them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kurowski
kurowski marked this pull request as draft November 12, 2026 17:32
@kurowski

Copy link
Copy Markdown
Member Author

see comments here https://github.com/UCEAP/.github-private/wiki/Developer-Meeting-Agenda-2026-11-12#deployment-change and think REAL HARD about them before merging

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