MDL-14902 Missing column 'whatgrade' in prefix_scorm table. Is a DB patch (thanks...
authorpiers <piers>
Fri, 1 Aug 2008 02:32:36 +0000 (02:32 +0000)
committerpiers <piers>
Fri, 1 Aug 2008 02:32:36 +0000 (02:32 +0000)
mod/scorm/db/install.xml
mod/scorm/db/upgrade.php
mod/scorm/version.php

index 3b4c99b..1386d83 100644 (file)
@@ -13,8 +13,9 @@
         <FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="reference" NEXT="version"/>
         <FIELD NAME="version" TYPE="char" LENGTH="9" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="summary" NEXT="maxgrade"/>
         <FIELD NAME="maxgrade" TYPE="float" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="version" NEXT="grademethod"/>
-        <FIELD NAME="grademethod" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="maxgrade" NEXT="maxattempt"/>
-        <FIELD NAME="maxattempt" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="grademethod" NEXT="updatefreq"/>
+        <FIELD NAME="grademethod" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="maxgrade" NEXT="whatgrade"/>
+        <FIELD NAME="whatgrade" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="grademethod" NEXT="maxattempt"/>
+        <FIELD NAME="maxattempt" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="whatgrade" NEXT="updatefreq"/>
         <FIELD NAME="updatefreq" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Define when the package must be automatically update" PREVIOUS="maxattempt" NEXT="md5hash"/>
         <FIELD NAME="md5hash" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="MD5 Hash of package file" PREVIOUS="updatefreq" NEXT="launch"/>
         <FIELD NAME="launch" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="md5hash" NEXT="skipview"/>
index e27bd65..3106478 100644 (file)
@@ -21,11 +21,27 @@ function xmldb_scorm_upgrade($oldversion=0) {
 
     global $CFG, $THEME, $DB;
 
+    $dbman = $DB->get_manager();
+
     $result = true;
 
 //===== 1.9.0 upgrade line ======//
 
+    // Adding missing 'whatgrade' field to table scorm
+    if ($result && $oldversion < 2008073000) {
+        $table = new xmldb_table('scorm');
+        $field = new xmldb_field('whatgrade');
+        $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'grademethod');
+        
+        /// Launch add field whatgrade
+        if(!$dbman->field_exists($table,$field)) {
+            $dbman->add_field($table, $field);
+        }
+        
+        upgrade_mod_savepoint($result, 2008073000, 'scorm');
+    }
+    
     return $result;
 }
 
-?>
+?>
\ No newline at end of file
index 50c9bc1..98ca6a3 100755 (executable)
@@ -10,8 +10,8 @@
 //       catch up now, so until 27th October please only increment in very tiny steps 
 //       in HEAD, until we get past that date..
 
-$module->version  = 2007110500;   // The (date) version of this module
+$module->version  = 2008073100;   // The (date) version of this module
 $module->requires = 2007101509;   // The version of Moodle that is required
 $module->cron     = 300;            // How often should cron check this module (seconds)?
 
-?>
+?>
\ No newline at end of file