From: dongsheng Date: Tue, 29 Apr 2008 06:49:14 +0000 (+0000) Subject: "MDL-14548, modify the notification field in data module to NOT NULL and default... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=54c1f2d5fea11d4f410493906a64f3ab7707628b;p=moodle.git "MDL-14548, modify the notification field in data module to NOT NULL and default value 0, the version is incorrect, fix it." --- diff --git a/mod/data/db/upgrade.php b/mod/data/db/upgrade.php index a10e12dbd5..1b3d222f3c 100644 --- a/mod/data/db/upgrade.php +++ b/mod/data/db/upgrade.php @@ -96,7 +96,20 @@ function xmldb_data_upgrade($oldversion=0) { $result = $result && add_index($table, $index); } } - if ($result && $oldversion < 2007101512) { + + if ($result && $oldversion < 2007101512) { + /// Launch add field asearchtemplate again if does not exists yet - reported on several sites + + $table = new XMLDBTable('data'); + $field = new XMLDBField('asearchtemplate'); + $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'jstemplate'); + + if (!field_exists($table, $field)) { + $result = $result && add_field($table, $field); + } + } + + if ($result && $oldversion < 2007101513) { // Upgrade all the data->notification currently being // NULL to 0 $sql = "UPDATE {$CFG->prefix}data SET notification=0 WHERE notification IS NULL"; @@ -110,18 +123,6 @@ function xmldb_data_upgrade($oldversion=0) { $result = $result && change_field_default($table, $field); } - if ($result && $oldversion < 2007101513) { - /// Launch add field asearchtemplate again if does not exists yet - reported on several sites - - $table = new XMLDBTable('data'); - $field = new XMLDBField('asearchtemplate'); - $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'jstemplate'); - - if (!field_exists($table, $field)) { - $result = $result && add_field($table, $field); - } - } - return $result; }