So this afternoon i'm trying to restore two of my courses from Moodle 4.1 to Moodle 4.5 via CLI. However, i keep getting this error
Restoring course backup-moodle2-course-899-1604c063_web_framework_programming-20250728-2147-nu.mbz to category 15
== Extracting backup file to: /DATA/ulsdata_45/temp/backup/43e5613dd203569dba6dd6888e0b1ec3 ==
== Preprocessing backup file ==
== Cleaning temp data ==
!!! Exception - Error writing to database (Duplicate entry '0-18' for key 'mdl_course_modules_viewed.mdl_courmoduview_usecou_uix'
INSERT INTO mdl_course_modules_viewed (userid,timecreated,coursemoduleid) VALUES(?,?,?)
[array (
0 => 0,
1 => '1725239449',
2 => 18,
)]) !!!
Restoring course backup-moodle2-course-889-1604c033_database-20250728-2144-nu.mbz to category 15
== Extracting backup file to: /DATA/ulsdata_45/temp/backup/3b4f9ee58ddacebe8a897e8d28a5207d ==
== Preprocessing backup file ==
== Cleaning temp data ==
!!! Exception - Error writing to database (Duplicate entry '0-30' for key 'mdl_course_modules_viewed.mdl_courmoduview_usecou_uix'
INSERT INTO mdl_course_modules_viewed (userid,timecreated,coursemoduleid) VALUES(?,?,?)
[array (
0 => 0,
1 => '1736591636',
2 => 30,
)]) !!!
I tried looking for solutions and i found this forum post, but it doesn't seem to be working on my case. I've looked through moodle forums and i only found several posts indicating this error and all solutions ive found is only on that post i attached. For more information, i'm currently using PHP 8.1.33 and MySQL 8.0.42. Both placed on a docker container.
by Shem Blixondi Humprey Hartono.