From d48bdc599c28a2b4f1f2fc6b6b098b79805c6b4b Mon Sep 17 00:00:00 2001 From: Jonathan Champ Date: Thu, 18 Jan 2024 11:57:47 -0500 Subject: [PATCH 1/2] db: revert registration upgrade; fix tables that upgraded The registration field definition was unintentionally changed. Some users upgraded after that change and have the wrong database column settings. After upgrading again, those users will have the correct column settings. --- db/upgrade.php | 16 +++++++++++++++- version.php | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/db/upgrade.php b/db/upgrade.php index b91c7428..a77f2712 100755 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -874,7 +874,7 @@ function xmldb_zoom_upgrade($oldversion) { $table = new xmldb_table('zoom'); // Define and conditionally add field registration. - $field = new xmldb_field('registration', XMLDB_TYPE_INTEGER, '1', null, null, null, null, 'option_auto_recording'); + $field = new xmldb_field('registration', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '2', 'option_auto_recording'); if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } @@ -933,5 +933,19 @@ function xmldb_zoom_upgrade($oldversion) { upgrade_mod_savepoint(true, 2023111600, 'zoom'); } + if ($oldversion < 2024012500) { + $table = new xmldb_table('zoom'); + $field = new xmldb_field('registration', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '2', 'option_auto_recording'); + + // Launch change of notnull for field registration. + $dbman->change_field_notnull($table, $field); + + // Launch change of default for field registration. + $dbman->change_field_default($table, $field); + + // Zoom savepoint reached. + upgrade_mod_savepoint(true, 2024012500, 'zoom'); + } + return true; } diff --git a/version.php b/version.php index 8b4428d7..62d6a42d 100755 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'mod_zoom'; -$plugin->version = 2023121400; +$plugin->version = 2024012500; $plugin->release = 'v5.1.4'; $plugin->requires = 2019052000; $plugin->maturity = MATURITY_STABLE; From e07be09f73115dbd3bcacc5331c469450eacccbc Mon Sep 17 00:00:00 2001 From: Jonathan Champ Date: Thu, 25 Jan 2024 11:16:01 -0500 Subject: [PATCH 2/2] db: explain upgrade step fixes regression --- db/upgrade.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/upgrade.php b/db/upgrade.php index a77f2712..9ade8467 100755 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -934,10 +934,11 @@ function xmldb_zoom_upgrade($oldversion) { } if ($oldversion < 2024012500) { + // Version 5.1.0 incorrectly upgraded the zoom table's registration field. It should not be null and should default to 2. $table = new xmldb_table('zoom'); $field = new xmldb_field('registration', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '2', 'option_auto_recording'); - // Launch change of notnull for field registration. + // Launch change of nullability for field registration. $dbman->change_field_notnull($table, $field); // Launch change of default for field registration.