Quantcast
Channel: Installing and upgrading help
Viewing all articles
Browse latest Browse all 47421

Problems updating to Moodle 3.5 with MySQL 8.0 and mod_chat

$
0
0
by Debbie Unterseher.  

The following was sent from my IT person, and might be helpful to others:


We had problems updating to Moodle 3.5 using MySQL 8.0 because the word system is a reserved word.  Had to make the following changes:


Changed the 'system' to be '`system`'

    if ($oldversion < 2017111301) {
        // Rename field 'system' on table 'chat_messages' as it is a reserved word in MySQL 8+.
        $table = new xmldb_table('chat_messages');
        $field = new xmldb_field('`system`');
        if ($dbman->field_exists($table, $field)) {
            $field->set_attributes(XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'groupid');
            // Extend the execution time limit of the script to 2 hours.
            upgrade_set_timeout(7200);
            // Rename it to 'issystem'.
            $dbman->rename_field($table, $field, 'issystem');
        }

        // Rename field 'system' on table 'chat_messages_current' as it is a reserved word in MySQL 8+.
        $table = new xmldb_table('chat_messages_current');
        $field = new xmldb_field('`system`');
        if ($dbman->field_exists($table, $field)) {
            $field->set_attributes(XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'groupid');
            // Extend the execution time limit of the script to 5 minutes.
            upgrade_set_timeout(300);
            // Rename it to 'issystem'.
            $dbman->rename_field($table, $field, 'issystem');
        }

        // Savepoint reached.
        upgrade_mod_savepoint(true, 2017111301, 'chat');
    }







Viewing all articles
Browse latest Browse all 47421

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>