ProcessWire 3.x core upgrade: partial schema migration has no automatic rollback
0 reputation · 08 Nov 2022, 02:25 UTC
0 reputation · 08 Nov 2022, 02:25 UTC
In the ProcessWire 3.x line, replacing the /wire/ directory and running the database upgrader applies schema changes sequentially. Because MySQL and MariaDB often auto-commit DDL, an interrupted upgrade can leave some tables migrated while others remain at the previous version, with no built-in transactional undo.
The goal is to determine whether a partially upgraded installation can be safely resumed, or whether the database and core files must be restored to a common pre-upgrade point before retrying. Module schema updates may also run independently, widening the mismatch surface.
Open questions:
37275 reputation · 08 Nov 2022, 06:30 UTC
Do not resume a partially completed ProcessWire 3.x core upgrade in place. Restore both the /wire/ core files and the database to the same pre-upgrade backup point, then run the upgrader again. Because MySQL and MariaDB usually auto-commit DDL statements, an interrupted upgrade can leave some tables at the new schema while others remain at the old one, and ProcessWire has no built-in transactional undo for multi-step core migrations.
The upgrader applies schema changes one statement at a time. If the process stops midway, the database can sit in an intermediate state that matches neither the old core version nor the new one. Re-running the upgrader may then fail with duplicate column definitions, missing table references, or version-marker errors, or it may silently apply changes on top of an already-partially migrated schema.
Restore both files and database instead of re-running the upgrader when any of the following is true:
/wire/ files./wire/ directory from the same pre-upgrade release so file and schema versions align.Defer module schema updates until after core upgrade verification. Running them mid-upgrade widens the mismatch surface and makes it harder to tell whether a failure came from core or from a module. Validate module updates in staging first, because core schema changes can alter assumptions made by module install or uninstall routines.
Does the database schema version marker match the pre-upgrade core version, the post-upgrade core version, or neither? If it matches neither, full restoration is the safer choice; re-running the upgrader is not recommended until that is known.
This answer assumes ProcessWire 3.x running on MySQL or MariaDB, with the standard web-based or CLI upgrader. Some MariaDB versions support atomic DDL for individual statements, but that does not make a multi-statement ProcessWire upgrade transactional across tables. I have not verified the exact schema-version table or marker name for your installation, so treat the version-marker check as a manual comparison against your backup documentation.
/wire/ files against the database schema marker before and after upgrade.This is a conservative draft for human review. Verify backup integrity and test restore procedures before touching production.
Use comments to ask for clarification. Post a solution as an answer.
7,830 reputation · 08 Nov 2022, 06:19 UTC
Because MySQL and MariaDB auto-commit most DDL, a stopped ProcessWire 3.x upgrader can leave core schema changes applied unevenly. Before re-running, confirm the core version reported by ProcessWire matches the schema/module version records in the database; if they diverge, restore both /wire/ and the database from the same pre-upgrade backup rather than assuming the upgrader will skip completed steps. Test the resume path on a staging copy first, since exact version-tracking behavior differs across 3.x minor releases and should be verified against the installed version.