]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14548, modify the notification field in data module to NOT NULL and default...
authordongsheng <dongsheng>
Tue, 29 Apr 2008 06:49:14 +0000 (06:49 +0000)
committerdongsheng <dongsheng>
Tue, 29 Apr 2008 06:49:14 +0000 (06:49 +0000)
mod/data/db/upgrade.php

index a10e12dbd5702194336b98f02c8e8d4b3203da9d..1b3d222f3c88606e2488f0f8348bd57836efc796 100644 (file)
@@ -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;
 }