Skip to content

Commit

Permalink
Included missing fields in upgrade method
Browse files Browse the repository at this point in the history
  • Loading branch information
prasanna-lmsace committed Oct 7, 2023
1 parent d49a64b commit e06f285
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<FIELD NAME="status" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="upcomingtime" TYPE="int" LENGTH="18" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="additional" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="isoverridden" TYPE="int" LENGTH="2" NOTNULL="false" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="isoverridden" TYPE="int" LENGTH="8" NOTNULL="false" DEFAULT="1" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="id" TYPE="primary" FIELDS="id"/>
Expand Down
23 changes: 22 additions & 1 deletion db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ function xmldb_pulse_upgrade($oldversion) {
$table->add_field('instanceid', XMLDB_TYPE_INTEGER, '18', null, XMLDB_NOTNULL, null, null, 'id');
$table->add_field('triggercondition', XMLDB_TYPE_CHAR, '200', null, XMLDB_NOTNULL, null, null, 'instanceid');
$table->add_field('status', XMLDB_TYPE_INTEGER, '2', null, null, null, '0', 'triggercondition');
$table->add_field('upcomingtime', XMLDB_TYPE_INTEGER, '18', null, null, null, null, 'status');
$table->add_field('additional', XMLDB_TYPE_TEXT, null, null, null, null, null, 'status');
$table->add_field('isoverriden', XMLDB_TYPE_INTEGER, '2', null, null, null, '1', 'additional');
$table->add_field('isoverridden', XMLDB_TYPE_INTEGER, '8', null, null, null, '1', 'additional');
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_key('unique', XMLDB_KEY_UNIQUE, array('instanceid', 'triggercondition'));

Expand Down Expand Up @@ -232,5 +233,25 @@ function xmldb_pulse_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2023051830, 'pulse');
}

if ($oldversion < 2023100701) {
// Auto templates instance.
$instable = new xmldb_table('pulse_condition_overrides');
$reference = new xmldb_field('isoverriden', XMLDB_TYPE_INTEGER, '8', null, null, null, '1');
// Verify field exists.
if ($dbman->field_exists($instable, $reference)) {
// Change the field.
$dbman->rename_field($instable, $reference, 'isoverridden');
}

// Upcoming time.
$upcomingtime = new xmldb_field('upcomingtime', XMLDB_TYPE_INTEGER, '18', null, null, null, null, 'status');
if (!$dbman->field_exists($instable, $upcomingtime)) {
$dbman->add_field($instable, $upcomingtime);
}

upgrade_mod_savepoint(true, 2023100701, 'pulse');
}


return true;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'mod_pulse';
$plugin->version = 2023051839;
$plugin->version = 2023100701;
$plugin->requires = 2020061500; // Requires Moodle 3.90.
$plugin->release = 'v2.0';
$plugin->maturity = MATURITY_STABLE;
Expand Down

0 comments on commit e06f285

Please sign in to comment.