MDL-14902 Missing column 'whatgrade' in prefix_scorm table. Is a DB patch (thanks...
[moodle.git] / mod / scorm / db / upgrade.php
1 <?php  //$Id$
3 // This file keeps track of upgrades to 
4 // the scorm module
5 //
6 // Sometimes, changes between versions involve
7 // alterations to database structures and other
8 // major things that may break installations.
9 //
10 // The upgrade function in this file will attempt
11 // to perform all the necessary actions to upgrade
12 // your older installtion to the current version.
13 //
14 // If there's something it cannot do itself, it
15 // will tell you what you need to do.
16 //
17 // The commands in here will all be database-neutral,
18 // using the methods of database_manager class
20 function xmldb_scorm_upgrade($oldversion=0) {
22     global $CFG, $THEME, $DB;
24     $dbman = $DB->get_manager();
26     $result = true;
28 //===== 1.9.0 upgrade line ======//
30     // Adding missing 'whatgrade' field to table scorm
31     if ($result && $oldversion < 2008073000) {
32         $table = new xmldb_table('scorm');
33         $field = new xmldb_field('whatgrade');
34         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'grademethod');
35         
36         /// Launch add field whatgrade
37         if(!$dbman->field_exists($table,$field)) {
38             $dbman->add_field($table, $field);
39         }
40         
41         upgrade_mod_savepoint($result, 2008073000, 'scorm');
42     }
43     
44     return $result;
45 }
47 ?>