From 0d44319a424d5c85c83e4fe092646ceefbee9891 Mon Sep 17 00:00:00 2001 From: Lai Wei Date: Fri, 27 Sep 2024 15:44:44 +0100 Subject: [PATCH] Update group and team cache tables name column precision --- local/o365/db/install.xml | 10 +++++----- local/o365/db/upgrade.php | 34 +++++++++++++++++++++++++++++++++- local/o365/version.php | 2 +- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/local/o365/db/install.xml b/local/o365/db/install.xml index fe4a38d07..9b0e84473 100644 --- a/local/o365/db/install.xml +++ b/local/o365/db/install.xml @@ -1,5 +1,5 @@ - @@ -155,8 +155,8 @@ - - + + @@ -168,8 +168,8 @@
- - + + diff --git a/local/o365/db/upgrade.php b/local/o365/db/upgrade.php index 1537ccd45..b4f0cf111 100644 --- a/local/o365/db/upgrade.php +++ b/local/o365/db/upgrade.php @@ -1171,7 +1171,6 @@ function xmldb_local_o365_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2023042426, 'local', 'o365'); } - if ($oldversion < 2023042427) { // Fix data type issue in calsyncinlastrun config. $calsyncinlastrun = get_config('local_o365', 'calsyncinlastrun'); @@ -1188,5 +1187,38 @@ function xmldb_local_o365_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2023042427, 'local', 'o365'); } + if ($oldversion < 2023042433) { + // Changing precision of field objectid on table local_o365_groups_cache to (36). + $table = new xmldb_table('local_o365_groups_cache'); + $field = new xmldb_field('objectid', XMLDB_TYPE_CHAR, '36', null, XMLDB_NOTNULL, null, null, 'id'); + + // Launch change of precision for field objectid. + $dbman->change_field_precision($table, $field); + + // Changing precision of field name on table local_o365_groups_cache to (256). + $table = new xmldb_table('local_o365_groups_cache'); + $field = new xmldb_field('name', XMLDB_TYPE_CHAR, '256', null, null, null, null, 'objectid'); + + // Launch change of precision for field name. + $dbman->change_field_precision($table, $field); + + // Changing precision of field objectid on table local_o365_teams_cache to (36). + $table = new xmldb_table('local_o365_teams_cache'); + $field = new xmldb_field('objectid', XMLDB_TYPE_CHAR, '36', null, XMLDB_NOTNULL, null, null, 'id'); + + // Launch change of precision for field name. + $dbman->change_field_precision($table, $field); + + // Changing precision of field name on table local_o365_teams_cache to (264). + $table = new xmldb_table('local_o365_teams_cache'); + $field = new xmldb_field('name', XMLDB_TYPE_CHAR, '264', null, null, null, null, 'objectid'); + + // Launch change of precision for field objectid. + $dbman->change_field_precision($table, $field); + + // O365 savepoint reached. + upgrade_plugin_savepoint(true, 2023042433, 'local', 'o365'); + } + return true; } diff --git a/local/o365/version.php b/local/o365/version.php index ec596ded3..8af167d6a 100644 --- a/local/o365/version.php +++ b/local/o365/version.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023042431; +$plugin->version = 2023042433; $plugin->requires = 2023042400; $plugin->release = '4.2.7'; $plugin->component = 'local_o365';