From f77e4ce527430def5c2ffcec68464dcc090fa4d2 Mon Sep 17 00:00:00 2001 From: Marcus Green Date: Fri, 13 Oct 2023 21:37:46 +0100 Subject: [PATCH] add db/upgrade.php --- db/upgrade.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ version.php | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 db/upgrade.php diff --git a/db/upgrade.php b/db/upgrade.php new file mode 100644 index 0000000..1408b1b --- /dev/null +++ b/db/upgrade.php @@ -0,0 +1,49 @@ +. + +/** + * Capability definitions for the driprelease + * + * @package tool_driprelease + * @copyright 2022 Marcus Green + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Upgrade code for tool_driprelease. + * @param int $oldversion the version we are upgrading from. + */ +function xmldb_tool_driprelease($oldversion = 0) { + global $DB; + + $dbman = $DB->get_manager(); + if ($oldversion < 2023100300) { + + // Define field coursegroup to be added to tool_driprelease. + $table = new xmldb_table('tool_driprelease'); + $field = new xmldb_field('coursegroup', XMLDB_TYPE_CHAR, '50', null, null, null, null, 'sessionlength'); + + // Conditionally launch add field coursegroup. + if (!$dbman->field_exists($table, $field)) { + $dbman->add_field($table, $field); + } + + // Driprelease savepoint reached. + upgrade_plugin_savepoint(true, 2023100300, 'tool', 'driprelease'); + } + + return true; +} \ No newline at end of file diff --git a/version.php b/version.php index 4234125..9e29bcd 100644 --- a/version.php +++ b/version.php @@ -26,6 +26,6 @@ $plugin->component = 'tool_driprelease'; $plugin->release = '0.2.0'; -$plugin->version = 2023021600; +$plugin->version = 2023100300; $plugin->requires = 2020110900; $plugin->maturity = MATURITY_BETA;