Skip to content

Commit

Permalink
fix field default value error in local_o365
Browse files Browse the repository at this point in the history
  • Loading branch information
weilai-irl committed Mar 12, 2024
1 parent c002327 commit c5fce15
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion local/o365/db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
<FIELD NAME="teamname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="courseshortname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="requeststatus" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="null" SEQUENCE="false"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
Expand Down
18 changes: 18 additions & 0 deletions local/o365/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -1141,5 +1141,23 @@ function xmldb_local_o365_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2023042417, 'local', 'o365');
}

if ($oldversion < 2023042421) {
$sql = 'UPDATE {local_o365_course_request} SET courseid = 0 WHERE courseid IS NULL';
$DB->execute($sql);

// Changing the default of field courseid on table local_o365_course_request to 0.
$table = new xmldb_table('local_o365_course_request');
$field = new xmldb_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'requeststatus');

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

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

// O365 savepoint reached.
upgrade_plugin_savepoint(true, 2023042421, 'local', 'o365');
}

return true;
}
4 changes: 2 additions & 2 deletions local/o365/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

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

$plugin->version = 2023042420;
$plugin->version = 2023042421;
$plugin->requires = 2023042400;
$plugin->release = '4.2.3';
$plugin->release = '4.2.4';
$plugin->component = 'local_o365';
$plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = [
Expand Down
6 changes: 3 additions & 3 deletions local/office365/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@

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

$plugin->version = 2023042420;
$plugin->version = 2023042421;
$plugin->requires = 2023042400;
$plugin->release = '4.2.3';
$plugin->release = '4.2.4';
$plugin->component = 'local_office365';
$plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = [
'auth_oidc' => 2023042420,
'block_microsoft' => 2023042420,
'local_o365' => 2023042420,
'local_o365' => 2023042421,
'repository_office365' => 2023042420,
'theme_boost_o365teams' => 2023042405,
];

0 comments on commit c5fce15

Please sign in to comment.