MDL-14902 Missing column 'whatgrade' in prefix_scorm table. Is a DB patch (thanks...
[moodle.git] / mod / scorm / db / upgrade.php
CommitLineData
b8a342d7 1<?php //$Id$
2
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,
b1f93b15 18// using the methods of database_manager class
b8a342d7 19
20function xmldb_scorm_upgrade($oldversion=0) {
21
219f652b 22 global $CFG, $THEME, $DB;
b8a342d7 23
c57ce9f2 24 $dbman = $DB->get_manager();
25
b8a342d7 26 $result = true;
27
219f652b 28//===== 1.9.0 upgrade line ======//
9858605e 29
c57ce9f2 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
b8a342d7 44 return $result;
45}
46
c57ce9f2 47?>