Upgrading 1.9.7 => 16.04.4 causes fatal DB error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Won't Fix
|
Medium
|
Robert Lyon |
Bug Description
Error:
[WAR] 75 (lib/dml.php:514) Failed to get a recordset: mysqli error: [1146: Table 'mahara_
[WAR] 75 (lib/dml.php:514) Command was: SELECT "id" FROM "artefact_
Call stack (most recent first):
* get_recordset_
* get_field_
* get_field(
* EmbeddedImage:
* xmldb_artefact_
* upgrade_
* upgrade_
The reason is that the artefact.blog upgrade for version 2015011501 assumes that the artefact.file upgrade for 2015111200 has already taken place and, hence, that the table 'artefact_
This is not the case for an upgrade from 1.9.7 to 16.04.4.
To work around this I've forced artefact.file to be the first artefact to be upgraded, by adding the following code to 'sort_upgrades':
if ($weight1 == $weight2) {
if ($k1 == 'artefact.file') {
return -1;
} else if ($k2 == 'artefact.file') {
return 1;
}
}
This is a temporary change to make sure that the upgrade can be completed (which it has now done), but reporting here in the hope that this will save anyone else having similar problems.
summary: |
- Upgradeing 1.9.7 => 16.04.4 causes fatal DB error + Upgrading 1.9.7 => 16.04.4 causes fatal DB error |
no longer affects: | mahara/17.10 |
Changed in mahara: | |
milestone: | 17.04.1 → 18.04.0 |
Hi davosmith,
I'm glad you were able to sort out your problem.
Upon looking at the code what would be useful is if we could pass in an overriding weight/dependency value based on what needs to be upgraded and from what version to what other version.
So that we could do the upgrades for things that add/edit/drop tables first before doing other upgrades.
I suspect this won't be an easy change - so for the interim I'll note here that upgrading from one major version to the next to the next should be fine to do
Cheers
Robert