Skip to content

Commit

Permalink
add db/upgrade.php
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Oct 13, 2023
1 parent 3f94fe7 commit f77e4ce
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
49 changes: 49 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* 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;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit f77e4ce

Please sign in to comment.