Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Ballard Ingram -
Number of replies: 13
Hello,

I am upgrading from 4.2.3 to 4.3 and received the following error:


I am unsure how to fix this. Any suggestions?
Average of ratings: -
In reply to Ballard Ingram

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers
This can happen if there was a previous attempted upgrade but this was rolled back by restoring the Moodle 4.2 database. This is because restoring a database created by mysqldump leaves the new 4.3 tables in place. You need to delete the Moodle database (back it up first as a precaution), create a new empty Moodle database, restore the 4.2 backup into this database, and then re-attempt the upgrade.
Average of ratings: Useful (2)
In reply to Leon Stringer

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Ballard Ingram -
Thank you Mr. Stringer for the reply. I am going to give this a try now.
In reply to Leon Stringer

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Robert Wagenhoffer -
Hello,

Have the same issue going from 4.2.3 to 4.3. Read your suggestions but did not create a new database, was concerned about getting everything configured correctly. Instead, I went into my actual database, dropped all the table and then uploaded a backup database. Unfortunately, the error did not go away and I am curious if anyone has any other suggestions. Note, I am assuming that dropping all the tables and installing the back up accomplished the same thing as creating a new database?

Thanks
In reply to Robert Wagenhoffer

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Yes, dropping all the tables is the same thing as creating a new database as far as restoring is concerned.

You're getting exactly the same message, column "communication->contextid" cannot be modified. Dependency found with index "mdl_comm_con_ix (contextid)"? After restoring the database check if the mdl_communication table is present before reattempting the upgrade. If so, then your database backup already contains 4.3 tables. You could try dropping that table before reattempting the upgrade, but any other unexpected 4.3 tables may cause similar errors (because they shouldn't be there).
In reply to Leon Stringer

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Robert Wagenhoffer -
Tried your suggestion and it eliminate the original error. However, now I get:

Error writing to database

More information about this error

Debug info: Duplicate entry 'cmi.core.exit' for key 'mdlng_scorm_element.mdlng_scorelem_ele_uix'
INSERT INTO mdlng_scorm_element (element)
SELECT DISTINCT element FROM mdlng_scorm_scoes_track
[array (
)]
Error code: dmlwriteexception

Thanks for the assistance...
In reply to Robert Wagenhoffer

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Another Moodle 4.3 table is already present before the upgrade, this time ndlng_scorm_element. I think this is the complete list of tables added in Moodle 4.3 that did not exist in Moodle 4.2:

  1. mdl_communication
  2. mdl_communication_customlink
  3. mdl_communication_user
  4. mdl_lti_coursevisible
  5. mdl_lti_types_categories
  6. mdl_matrix_room
  7. mdl_moodlenet_share_progress
  8. mdl_scorm_attempt
  9. mdl_scorm_element
  10. mdl_scorm_scoes_value
  11. mdl_tool_dataprivacy_contextlist
  12. mdl_tool_dataprivacy_ctxlst_ctx
  13. mdl_tool_dataprivacy_rqst_ctxlst
  14. mdl_tool_mfa
  15. mdl_tool_mfa_auth
  16. mdl_tool_mfa_secrets
None of these tables should exist before upgrading to Moodel 4.3. Try dropping these after restoring the database. Change 'mdl_' to 'mdlng_ if that's your $CFG->prefix.
Average of ratings: Useful (2)
In reply to Robert Wagenhoffer

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Robert Wagenhoffer -
Was able to upgrade my testbed to 4.3. Deleted the mdlng_scorom_element table and then ran into Illegal Mix of collations. Solved that by using ALTER TABLE mdlng_scorm_element CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;

I know this will not be well received, but Moodle upgrades have become a nightmare. Could not update any of my SCORM courses for three months because of a bug in the update prior to 4.2.3 and it took a lot of playing around to get to 4.3 I now need a stiff drink to get up the courage to try this on my productions site....

Thank you again for helping me.
In reply to Robert Wagenhoffer

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

It sounds like tables for this site were created using the default collation which can change between MySQL/MariaDB versions. Moodle's installation instructions include explicitly setting the default collation to utf8mb4_unicode_ci so all tables have the same setting. If this has been done the Illegal mix of collations settings error cannot occur.

For production sites I don't recommend upgrading to a new major release until the first .1 update, in this case 4.3.1 due on 11 December 2023. Unless the customer insists, of course!

If you're using SCORMs you might want to delay upgrading to Moodle 4.3 until this bug is fixed: MDL-79967 SCORM activity completion no longer possible.

Average of ratings: Useful (2)
In reply to Leon Stringer

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Ken Task -
Picture of Particularly helpful Moodlers
And 2 cents more for others who might run across this thread ...

Clips from something that explained ... I did not write it! smile

The collation utf8mb4_0900_ai_ci is a character set collation for MySQL databases, introduced in MySQL 8.0. 1. It is based on the Unicode Collation Algorithm (UCA) 9.0. 0, and the character set is utf8mb4, which supports a wide range of Unicode characters.

utf8mb4_0900_ai_ci is explicitly case-insensitive and accent-insensitive.


Directions/recommendations in moodle docs began with earlier versions of MySQL/MariaDB so collation utf8mb4_unicode_ci was and still is a *SAFE* setting.

Since most of us do not build servers from scratch and are using remotely hosted built by hosting provider, it might be wise to run:

php mysql_collation.php -a

which shows what collations are available before assuming! :|

'SoS', Ken
In reply to Leon Stringer

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Ken Task -
Picture of Particularly helpful Moodlers
And 4 cents more ...
Since OP is dreading production instance and OP is working with a test site, perfect time to get the test site running git for Moodle.

On the test site, running a simple git pull will show what's being updated/changed as far as code is concerned.
4.3 is now a +
4.3+ (Build: 20231102)
and when the fix for SCORM's is released via git, OP will see references to the changes to SCORM.

To actually do the upgrade, from code directory:

php admin/cli/upgrade.php [ENTER]

That surely beats the heck out of any other method of updating/upgrading/maintaining a moodle ... IMHO, of course. smile

'SoS', Ken




In reply to Ken Task

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by 志军 董 -
Anyone update? I've still got the ddldepdencyerror when upgrade from 4.2.5+ (Build: 20240104) to Moodle 4.3.2+ (Build: 20240119) 
In reply to Leon Stringer

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Joseph Gitau -

We faced the ddldependencyerror error with the database of your website due to the fact that the mdl3u_communication table cannot be modified.

How do i rectify this, am trying to upgrade from moodle 4.4 to 4.4.2

In reply to Joseph Gitau

Re: Upgrade from 4.2.3 to 4.3 Fails (ddldepdencyerror)

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

From a quick check of the source code I can't see that Moodle should make any changes to mdl3u_communication when upgrading from 4.4 to 4.4.2.

Enable debugging to show more details with the error message which may help us identify what's causing this.