Moodle 3.5 to 3.9 upgrade FAIL

Re: Moodle 3.5 to 3.9 upgrade FAIL

by Leon Stringer -
Number of replies: 1
Picture of Core developers Picture of Particularly helpful Moodlers

Presumably MySQL (or MariaDB) is in use as the site database?

I think after the failed first upgrade attempt some new tables including mdl_badge_alignment were created.

When the 3.5 database was restored this didn't remove the new tables, this is the default behaviour with mysqldump/mysql < XXX.sql.

So the upgrade is failing because Moodle expects only the un-upgraded 3.5 tables to be present in the database.

The solution would be to either remove the new tables or, probably easiest, delete and re-create the database, e.g. assuming 1) it is MySQL/MariaDB, 2) the database character set and collation is utf8mb4 and utf8mb4_unicode_ci respectively, and 3) the database is called moodle:

DROP DATABASE moodle;
CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Then do the database restore and the upgrade should then work. If you upgrade using the command line then max_execution_time isn't an issue (it's 0, i.e. infinite) so there's no risk of a timeout.

In reply to Leon Stringer

Re: Moodle 3.5 to 3.9 upgrade FAIL

by Paul Ritchings -

Thanks Leon,

Yes we figured this out in the end.

When the 3.5 database was restored this didn't remove the new tables, this is the default behaviour with mysqldump/mysql < XXX.sql.