From 9858605e59f25d5cf474287cc66eeea2185a9fdb Mon Sep 17 00:00:00 2001 From: fmarier Date: Fri, 9 Nov 2007 01:25:28 +0000 Subject: [PATCH] Add missing fields when upgrading/installing on Postgres mod/exercise, mod/scorm and question/type/rqp MDL-12023 --- mod/exercise/db/postgres7.php | 4 ---- mod/exercise/db/upgrade.php | 14 ++++++-------- mod/exercise/version.php | 2 +- mod/scorm/db/upgrade.php | 9 +++++++++ mod/scorm/version.php | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/mod/exercise/db/postgres7.php b/mod/exercise/db/postgres7.php index d77f49b8ce..a78c6e88d4 100644 --- a/mod/exercise/db/postgres7.php +++ b/mod/exercise/db/postgres7.php @@ -11,10 +11,6 @@ function exercise_upgrade($oldversion) { global $CFG; - if ($oldversion < 2003121000) { - execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD `late` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'"); - } - if ($oldversion < 2004062300) { table_column("exercise", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade"); table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum"); diff --git a/mod/exercise/db/upgrade.php b/mod/exercise/db/upgrade.php index 066a8dc0e5..6ad8536dfe 100644 --- a/mod/exercise/db/upgrade.php +++ b/mod/exercise/db/upgrade.php @@ -23,14 +23,12 @@ function xmldb_exercise_upgrade($oldversion=0) { $result = true; -/// And upgrade begins here. For each one, you'll need one -/// block of code similar to the next one. Please, delete -/// this comment lines once this file start handling proper -/// upgrade code. - -/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php -/// $result = result of "/lib/ddllib.php" function calls -/// } + if ($result && $oldversion < 2007110500) { + $table = new XMLDBTable('exercise_submissions'); + $field = new XMLDBField('late'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0, 'isexercise'); + $result = $result && add_field($table, $field); + } return $result; } diff --git a/mod/exercise/version.php b/mod/exercise/version.php index 112eb50986..a3bf19423f 100644 --- a/mod/exercise/version.php +++ b/mod/exercise/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2007020200; +$module->version = 2007110500; $module->requires = 2007101000; // Requires this Moodle version $module->cron = 60; diff --git a/mod/scorm/db/upgrade.php b/mod/scorm/db/upgrade.php index a8c11c5ff7..73c0145260 100644 --- a/mod/scorm/db/upgrade.php +++ b/mod/scorm/db/upgrade.php @@ -282,6 +282,15 @@ function xmldb_scorm_upgrade($oldversion=0) { $db->debug = true; } + // Adding missing 'version' field to table scorm + if ($result && $oldversion < 2007110500) { + $table = new XMLDBTable('scorm'); + $field = new XMLDBField('version'); + $field->setAttributes(XMLDB_TYPE_CHAR, '9', null, XMLDB_NOTNULL, null, null, null, 'scorm_12', 'summary'); + + $result = $result && add_field($table, $field); + } + return $result; } diff --git a/mod/scorm/version.php b/mod/scorm/version.php index 405411ed18..9f7d46d31b 100755 --- a/mod/scorm/version.php +++ b/mod/scorm/version.php @@ -10,7 +10,7 @@ // catch up now, so until 27th October please only increment in very tiny steps // in HEAD, until we get past that date.. -$module->version = 2007081001; // The (date) version of this module +$module->version = 2007110500; // The (date) version of this module $module->requires = 2007101000; // The version of Moodle that is required $module->cron = 300; // How often should cron check this module (seconds)? -- 2.39.5