Skip to content

Commit

Permalink
Fix moodleou#123: Fix schema issues in report_customsql_categories
Browse files Browse the repository at this point in the history
  • Loading branch information
jnlar committed Dec 22, 2022
1 parent 55b1bcd commit 882afea
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,5 +269,21 @@ function xmldb_report_customsql_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2021111600, 'report', 'customsql');
}

if ($oldversion < 2022031801) {

// Changing nullability of field name on table report_customsql_categories to not null.
// Changing the default of field name on table report_customsql_categories to drop it.
$table = new xmldb_table('report_customsql_categories');
$field = new xmldb_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'id');

// Launch change of nullability for field name.
$dbman->change_field_notnull($table, $field);
// Launch change of default for field name.
$dbman->change_field_default($table, $field);

// Report savepoint reached.
upgrade_plugin_savepoint(true, 2022031801, 'report', 'customsql');
}

return true;
}
2 changes: 1 addition & 1 deletion tests/local/category_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @copyright 2021 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class _category_test extends \advanced_testcase {
class category_test extends \advanced_testcase {
/**
* Test create category.
*/
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2022031800;
$plugin->version = 2022031801;
$plugin->requires = 2020061500;
$plugin->component = 'report_customsql';
$plugin->maturity = MATURITY_STABLE;
Expand Down

0 comments on commit 882afea

Please sign in to comment.