Moodle Core and Database Systems: Interoperability of Schema‑Change Rollback
25.5K reputation · 18 Jun 2020, 18:22 UTC
Integration Question
The goal is to determine whether Moodle’s core upgrade engine can guarantee a safe rollback of a schema change across all supported database systems without relying on external backups. Moodle executes DDL statements through XMLDB without wrapping them in a transaction that can be rolled back; PostgreSQL permits transactional DDL and thus automatic rollback, while MySQL and MariaDB implicitly commit DDL, preventing such rollback. The upgrade process records executed changes but does not generate inverse SQL, leaving administrators to depend on backups or manual scripts for any rollback attempt. An open discussion in the Moodle tracker questions whether to add a DB‑agnostic rollback layer (storing reverse XMLDB changes) or to keep relying on external backups, with no agreed‑upon implementation timeline.
- What conditions must be met for Moodle to safely roll back a schema change on MySQL/MariaDB without external backups?
- How would a DB‑agnostic rollback layer need to store and apply inverse XMLDB changes to ensure consistency across PostgreSQL, MySQL, and MariaDB?
- Should Moodle defer schema‑change execution to a transactional wrapper only when the underlying DBMS supports it, and fall back to a manual rollback procedure otherwise?