From c5fce157de87df6aad540242e5b24c39451969f7 Mon Sep 17 00:00:00 2001 From: Lai Wei Date: Tue, 12 Mar 2024 16:01:55 +0000 Subject: [PATCH] fix field default value error in local_o365 --- local/o365/db/install.xml | 2 +- local/o365/db/upgrade.php | 18 ++++++++++++++++++ local/o365/version.php | 4 ++-- local/office365/version.php | 6 +++--- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/local/o365/db/install.xml b/local/o365/db/install.xml index 21cb55f14..808c8e0e2 100644 --- a/local/o365/db/install.xml +++ b/local/o365/db/install.xml @@ -184,7 +184,7 @@ - + diff --git a/local/o365/db/upgrade.php b/local/o365/db/upgrade.php index 31f6544fa..83f831b21 100644 --- a/local/o365/db/upgrade.php +++ b/local/o365/db/upgrade.php @@ -1141,5 +1141,23 @@ function xmldb_local_o365_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2023042417, 'local', 'o365'); } + if ($oldversion < 2023042421) { + $sql = 'UPDATE {local_o365_course_request} SET courseid = 0 WHERE courseid IS NULL'; + $DB->execute($sql); + + // Changing the default of field courseid on table local_o365_course_request to 0. + $table = new xmldb_table('local_o365_course_request'); + $field = new xmldb_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'requeststatus'); + + // Launch change of default for field courseid. + $dbman->change_field_default($table, $field); + + // Launch change of nullability for field courseid. + $dbman->change_field_notnull($table, $field); + + // O365 savepoint reached. + upgrade_plugin_savepoint(true, 2023042421, 'local', 'o365'); + } + return true; } diff --git a/local/o365/version.php b/local/o365/version.php index fff91d0fa..70236f191 100644 --- a/local/o365/version.php +++ b/local/o365/version.php @@ -26,9 +26,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023042420; +$plugin->version = 2023042421; $plugin->requires = 2023042400; -$plugin->release = '4.2.3'; +$plugin->release = '4.2.4'; $plugin->component = 'local_o365'; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = [ diff --git a/local/office365/version.php b/local/office365/version.php index f9db6609e..a12d6831d 100644 --- a/local/office365/version.php +++ b/local/office365/version.php @@ -25,15 +25,15 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023042420; +$plugin->version = 2023042421; $plugin->requires = 2023042400; -$plugin->release = '4.2.3'; +$plugin->release = '4.2.4'; $plugin->component = 'local_office365'; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = [ 'auth_oidc' => 2023042420, 'block_microsoft' => 2023042420, - 'local_o365' => 2023042420, + 'local_o365' => 2023042421, 'repository_office365' => 2023042420, 'theme_boost_o365teams' => 2023042405, ];