Permalink
Browse files

Add missing fields when upgrading/installing on Postgres

mod/exercise, mod/scorm and question/type/rqp
MDL-12023
  • Loading branch information...
fmarier
fmarier committed Nov 9, 2007
1 parent 3e79f5f commit abe9371c586989c1e597c68e0eb057d4464712ef
@@ -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");
@@ -28,9 +28,12 @@ function xmldb_exercise_upgrade($oldversion=0) {
/// 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 < 2006091202) {
+ $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;
}
View
@@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006091201;
+$module->version = 2006091202;
$module->requires = 2006080900; // Requires this Moodle version
$module->cron = 60;
@@ -23,14 +23,20 @@ function xmldb_qtype_rqp_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 < 2006032201) {
+ $table = new XMLDBTable('question_rqp_servers');
+
+ $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE);
+ $table->addFieldInfo('typeid', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);
+ $table->addFieldInfo('url', XMLDB_TYPE_CHAR, 255);
+ $table->addFieldInfo('can_render', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);
+ $table->addFieldInfo('can_author', XMLDB_TYPE_INTEGER, 2, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0);
+
+ $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->addKeyInfo('typeid', XMLDB_KEY_FOREIGN, array('typeid'), 'rqp_types', array('id'));
+
+ $result = $result && create_table($table);
+ }
return $result;
}
@@ -1,6 +1,6 @@
<?PHP // $Id$
-$plugin->version = 2006032200;
+$plugin->version = 2006032201;
$plugin->requires = 2006032200;
?>

0 comments on commit abe9371

Please sign in to comment.