From: Francois Marier <francois@catalyst.net.nz>
Date: Wed, 24 Oct 2007 02:16:06 +0000 (+1300)
Subject: mod/exercise/upgrade: Add the 'late' field to the exercise_submissions table
X-Git-Url: http://gitprivate/gw?p=moodle-r2.git;a=commitdiff_plain;h=f1ad1eeb2ec7fa9c61cddc5d1419bbb8fd64dda5;hp=ed108d099ab2fd080779cd1cb1a6572f3fd76c9f

mod/exercise/upgrade: Add the 'late' field to the exercise_submissions table
Fresh installs add this field, but upgrades on postgres did not.
---

diff --git a/mod/exercise/db/upgrade.php b/mod/exercise/db/upgrade.php
index 066a8dc..fc4c44b 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 < 2007020201) {
+        $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 966e4ed..ce7846c 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  = 2007020201;
 $module->requires = 2007101000;  // Requires this Moodle version
 $module->cron     = 60;
 
