Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

MDL-26811 upgrade Fixed up default handling causing exception on upgr…

…ade of used site in MSSQL
  • Loading branch information...
commit ed9041c9ceb27c962f381840f3002dfec7fff35a 1 parent e4527c5
@samhemelryk samhemelryk authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/db/upgrade.php
8 lib/db/upgrade.php
@@ -1230,8 +1230,14 @@ function xmldb_main_upgrade($oldversion) {
$field = new xmldb_field('backuptype', XMLDB_TYPE_CHAR, '50', null, XMLDB_NOTNULL, null, null, 'info');
/// Conditionally Launch add field backuptype and set all old records as 'scheduledbackup' records.
if (!$dbman->field_exists($table, $field)) {
+ // Set the default we want applied to any existing records
+ $field->setDefault('scheduledbackup');
+ // Add the field to the database
$dbman->add_field($table, $field);
- $DB->execute("UPDATE {backup_log} SET backuptype='scheduledbackup'");
+ // Remove the default
+ $field->setDefault(null);
+ // Update the database to remove the default
+ $dbman->change_field_default($table, $field);
/// Main savepoint reached
Please sign in to comment.
Something went wrong with that request. Please try again.