Skip to content

Commit

Permalink
MDL-72377 grade: increase size of category hidden fields.
Browse files Browse the repository at this point in the history
As well as storing 1/0 to indicate hidden state, they are also used
to store a timestamp indicating hidden until date. Increasing field
size allows these values to be stored without triggering exceptions.
  • Loading branch information
paulholden committed Jun 6, 2022
1 parent 5500d14 commit 67b1549
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1927,7 +1927,7 @@
<FIELD NAME="aggregateoutcomes" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Aggregate outcomes"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="hidden" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="hidden" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
Expand Down Expand Up @@ -2068,7 +2068,7 @@
<FIELD NAME="aggregateonlygraded" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="aggregate only graded items"/>
<FIELD NAME="aggregateoutcomes" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Aggregate outcomes"/>
<FIELD NAME="aggregatesubcats" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="This setting was removed from grade_categories. It is kept here only to preserve history."/>
<FIELD NAME="hidden" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="hidden" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
Expand Down
20 changes: 20 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4545,5 +4545,25 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2022052700.02);
}

if ($oldversion < 2022060300.01) {

// Changing precision of field hidden on table grade_categories to (10).
$table = new xmldb_table('grade_categories');
$field = new xmldb_field('hidden', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'timemodified');

// Launch change of precision for field hidden.
$dbman->change_field_precision($table, $field);

// Changing precision of field hidden on table grade_categories_history to (10).
$table = new xmldb_table('grade_categories_history');
$field = new xmldb_field('hidden', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'aggregatesubcats');

// Launch change of precision for field hidden.
$dbman->change_field_precision($table, $field);

// Main savepoint reached.
upgrade_main_savepoint(true, 2022060300.01);
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

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

$version = 2022060300.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2022060300.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.1dev (Build: 20220603)'; // Human-friendly version name
Expand Down

0 comments on commit 67b1549

Please sign in to comment.