]> git.mjollnir.org Git - moodle.git/commitdiff
bug related to postgres - inserts into prefix_exercise_assessments were failing,
authormjollnir_ <mjollnir_>
Fri, 10 Sep 2004 04:42:01 +0000 (04:42 +0000)
committermjollnir_ <mjollnir_>
Fri, 10 Sep 2004 04:42:01 +0000 (04:42 +0000)
because generalcomment and teachercomment were not null and didn't have defaults.
for some reason mysql allows this but postgres complains. I've set empty string defaults and added into mysql for consistency.

mod/exercise/db/mysql.php
mod/exercise/db/mysql.sql
mod/exercise/db/postgres7.php
mod/exercise/db/postgres7.sql
mod/exercise/version.php

index 03e75ffd5a89a44074dc4418e4eea7c40a13227e..50388c00cd897c5277b0c53ad763fa02a715d605 100644 (file)
@@ -30,6 +30,10 @@ function exercise_upgrade($oldversion) {
                table_column("exercise", "", "password", "VARCHAR", "32", "", "", "NOT NULL");
     }
 
+    if ($oldversion < 2004091000) {
+        table_column("exercise_assessments","generalcomment","generalcomment","text","","","","NOT NULL");
+        table_column("exercise_assessments","teachercomment","teachercomment","text","","","","NOT NULL");
+    }
     return true;
 }
 
index def08688c42e0ae5d643e3bf8e532f4943fe2141..d15b518903a0a6b54ce6cb9ff33ef89f3dd8f320 100644 (file)
@@ -57,8 +57,8 @@ CREATE TABLE `prefix_exercise_assessments` (
   `grade` float NOT NULL default '0',
   `gradinggrade` int(3) NOT NULL default '0',
   `mailed` tinyint(2) unsigned NOT NULL default '0',
-  `generalcomment` text NOT NULL,
-  `teachercomment` text NOT NULL,
+  `generalcomment` text NOT NULL default '',
+  `teachercomment` text NOT NULL default '',
    PRIMARY KEY  (`id`),
    INDEX (`submissionid`),
    INDEX (`userid`) 
index 1fdbb5ec75962b90bbfc8a66de99f25f13988a92..950d33595619d33b4374f283149df45a32d2f103 100644 (file)
@@ -20,6 +20,10 @@ function exercise_upgrade($oldversion) {
         table_column("exercise", "", "password", "VARCHAR", "32", "", "", "NOT NULL");
     }
 
+    if ($oldversion < 2004091000) {
+        table_column("exercise_assessments","generalcomment","generalcomment","text","","","","NOT NULL");
+        table_column("exercise_assessments","teachercomment","teachercomment","text","","","","NOT NULL");
+    }
 
     return true;
 }
index 387d8c23add509fae58539f4ede3f6cbe4921aae..0483624902a92c0fb97b11ac37ab2a3f20c41051 100644 (file)
@@ -55,8 +55,8 @@ CREATE TABLE prefix_exercise_assessments (
   grade float NOT NULL default '0',
   gradinggrade INT NOT NULL default '0',
   mailed INT2  NOT NULL default '0',
-  generalcomment text NOT NULL,
-  teachercomment text NOT NULL
+  generalcomment text NOT NULL default '',
+  teachercomment text NOT NULL default ''
   );
 # --------------------------------------------------------
 CREATE INDEX prefix_exercise_assessments_submissionid_idx ON prefix_exercise_assessments (submissionid);
index bf291f84db2bb2008c1c78f31cf7575d5118f22a..9a13129a2c8817ea1a16f58c7abfc8a062171420 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2004090200;
+$module->version  = 2004091000;
 $module->requires = 2004052505;  // Requires this Moodle version
 $module->cron     = 60;