diff -u -r1.9.16.1 postgres7.php
--- a/mod/exercise/db/postgres7.php	26 Oct 2006 22:29:55 -0000	1.9.16.1
+++ b/mod/exercise/db/postgres7.php	7 Nov 2007 03:43:24 -0000
@@ -11,10 +11,6 @@
 
     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
--- 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
--- 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;
 
