Skip to content
Browse files

Merge branch 'wip-MDL-26811-m20' of git://github.com/samhemelryk/mood…

…le into MOODLE_20_STABLE
  • Loading branch information...
2 parents 146ada0 + 179b60a commit 70e16becadeed2eff722a4e06cd7e9945c545f28 @nebgor nebgor committed Sep 5, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/db/upgrade.php
View
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

0 comments on commit 70e16be

Please sign in to comment.
Something went wrong with that request. Please try again.