From 86fa46f8b61f8987c1a59c78a62a44e8f83a53f5 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Tue, 16 Jun 2020 11:41:18 +0800 Subject: [PATCH] Upgrade step for format columns Add missing upgrade step for the following columns: * commentsformat * dpocommentformat --- db/upgrade.php | 23 +++++++++++++++++++++++ version.php | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/db/upgrade.php b/db/upgrade.php index 079379f..7d34548 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -201,5 +201,28 @@ function xmldb_tool_dataprivacy_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2017111316, 'tool', 'dataprivacy'); } + if ($oldversion < 2017111318) { + + // Define field commentsformat to be added to tool_dataprivacy_request. + $table = new xmldb_table('tool_dataprivacy_request'); + $field = new xmldb_field('commentsformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'comments'); + + // Conditionally launch add field commentsformat. + if (!$dbman->field_exists($table, $field)) { + $dbman->add_field($table, $field); + } + + // Define field dpocommentformat to be added to tool_dataprivacy_request. + $field = new xmldb_field('dpocommentformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'dpocomment'); + + // Conditionally launch add field dpocommentformat. + if (!$dbman->field_exists($table, $field)) { + $dbman->add_field($table, $field); + } + + // Dataprivacy savepoint reached. + upgrade_plugin_savepoint(true, 2017111318, 'tool', 'dataprivacy'); + } + return true; } diff --git a/version.php b/version.php index 39ec7cd..371f117 100644 --- a/version.php +++ b/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die; -$plugin->version = 2017111317; +$plugin->version = 2017111318; $plugin->requires = 2017111304.00; // Moodle 3.4.4 (Build: 20180517) and upwards. $plugin->component = 'tool_dataprivacy'; $plugin->release = '34.8.0';