database module MDL-24470 change 'notification' column ('data' table) default and NOT NULL. Update code for restore operation to support old backup with NULL value into 'notification'.

This commit is contained in:
jerome mouneyrac
2010-10-05 01:56:10 +00:00
parent 00067c196e
commit a3ed90bb6c
4 changed files with 23 additions and 3 deletions
+6
View File
@@ -97,6 +97,12 @@ function data_restore_mods($mod,$restore) {
$database->defaultsortdir = backup_todb($info['MOD']['#']['DEFAULTSORTDIR']['0']['#']);
$database->editany = backup_todb($info['MOD']['#']['EDITANY']['0']['#']);
$database->notification = backup_todb($info['MOD']['#']['NOTIFICATION']['0']['#']);
//fix related to MDL-24470: if someone restore a backup previous to this fix it would fail
//if notification = NULL as the column can not be NULL anymore
if (empty($database->notification)) {
$database->notification = 0;
}
// We have to recode the scale field if it's <0 (positive is a grade, not a scale)
if ($database->scale < 0) {