-
Bug
-
Resolution: Not a bug
-
Minor
-
None
-
4.4.1
-
MOODLE_404_STABLE
we are migrating from an amazon EC2, with RDS (db.t4g.medium) running moodle Moodle 4.2.2 (Build: 20230814) to a docker container solution using maria-db 11.2.4 and Moodle 4.4.1+ (Build: 20240614)
we created a mysqldump of the AWS RDS database and imported it to the new container's maria db database.
during the moodle upgrade process we run across the error.
````sql
Debug info: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='
INSERT INTO scorm_scoes_value (attemptid, scoid, elementid, value, timemodified)
SELECT a.id as attemptid, t.scoid as scoid, e.id as elementid, t.value as value, t.timemodified
FROM scorm_scoes_track t
JOIN scorm_element e ON e.element = t.element
JOIN scorm_attempt a ON (t.userid = a.userid AND t.scormid = a.scormid AND a.attempt = t.attempt)
[array (
)]
Error code: dmlwriteexception
````
i had a look at the upgrade code in the scorm module (mod/scorm/db/upgrade.php) and the scorm_scoes_track table is deleted in the upgrade process.
the issue reported is a mixture of collations.
we fixed this by running the query on the imported data:
```sql
ALTER TABLE `scorm_scoes_track` CHANGE `element` `element` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';
```
because moodle is 'baked in' to our container/image we can't change the moodle code.
suggest you fix by changing the query to (untested)
```php
$sql = "INSERT INTO {scorm_scoes_value} (attemptid, scoid, elementid, value, timemodified)
SELECT a.id as attemptid, t.scoid as scoid, e.id as elementid, t.value as value, t.timemodified
FROM {scorm_scoes_track} t
JOIN {scorm_element} e ON e.element collate DATABASE_DEFAULT = t.element collate DATABASE_DEFAULT
JOIN {scorm_attempt} a ON (t.userid = a.userid AND t.scormid = a.scormid AND a.attempt = t.attempt)";
```
- has been marked as being related by
-
MDL-80483 Upgrade from 4.2 to 4.3 MS SQL Collation error
-
- Open
-