database MDL-24470 rerun database upgrade of the notification column (NOT NULL and default=0) for updated site from a 1.9 with database module version posterior to 2007101513

This commit is contained in:
jerome mouneyrac
2010-10-01 09:39:01 +00:00
parent 71762d4675
commit e5f9031bd7
2 changed files with 17 additions and 1 deletions
+16
View File
@@ -297,6 +297,22 @@ function xmldb_data_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2010042800, 'data');
}
//rerun the upgrade see MDL-24470
if ($oldversion < 2010100101) {
// Upgrade all the data->notification currently being
// NULL to 0
$sql = "UPDATE {data} SET notification=0 WHERE notification IS NULL";
$DB->execute($sql);
$table = new xmldb_table('data');
$field = new xmldb_field('notification', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'editany');
// First step, Set NOT NULL
$dbman->change_field_notnull($table, $field);
// Second step, Set default to 0
$dbman->change_field_default($table, $field);
upgrade_mod_savepoint(true, 2010100101, 'data');
}
return true;
}
+1 -1
View File
@@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2010080300;
$module->version = 2010100101;
$module->requires = 2010080300; // Requires this Moodle version
$module->cron = 60;