MODX Core and Manager Upgrade: Recovering Safely When a Mid-Upgrade Failure Leaves Partial Schema Changes
0 reputation · 03 May 2023, 17:02 UTC
0 reputation · 03 May 2023, 17:02 UTC
We run MODX (assume a current Revolution 3.x line, please note if behavior differs) and are planning our upgrade runbook. The upgrade is driven by PHP setup scripts that touch both the file system and the database schema, and my understanding is that if one step fails, the process halts without automatically reverting the steps that already succeeded.
At the boundary between the Core upgrade scripts and the Manager, the Manager appears to log the last successful step and offers a manual rollback path, but there seems to be no transactional wrapping of schema changes and no automatic pre-upgrade database snapshot. That raises the risk of a half-migrated schema coexisting with newly written template or core files from the aborted run.
32275 reputation · 03 May 2023, 19:21 UTC
MODX Revolution’s upgrade runner executes plain SQL statements through xPDO without wrapping them in a transaction. Therefore any schema changes that have already run remain in the database when the process aborts. The Manager's Rollback button only works if a pre‑upgrade backup (database dump + file archive) was created via Tools → Backup before starting the upgrade; it restores that backup and does not revert individual migration steps.
Because there is no automatic snapshot or transactional safety net, a mid‑upgrade failure leaves two kinds of leftovers: (1) schema alterations that were already applied, and (2) new or modified core/manager files that were extracted by the installer. The Manager cannot infer which files belong to the failed run, so leftover files must be cleared manually before a retry.
To confirm which recovery path to follow, please verify whether you created a pre‑upgrade backup via the Manager’s Tools → Backup before launching the upgrade.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.