MDL-11433 Correcting non-null and default value (Default will be NULL)
authornicolasconnault <nicolasconnault>
Tue, 25 Sep 2007 09:47:40 +0000 (09:47 +0000)
committernicolasconnault <nicolasconnault>
Tue, 25 Sep 2007 09:47:40 +0000 (09:47 +0000)
lib/db/install.xml
lib/db/upgrade.php
version.php

index 223d5cb2cfcd16dfbff1d0f4a91ff10869a83ee6..5f8fef87f9000553de8103f239feebd19492d545 100644 (file)
         <FIELD NAME="aggregationcoef" TYPE="number" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" DECIMALS="5" COMMENT="Aggregation coefficient used for category weights or other aggregation types" PREVIOUS="plusfactor" NEXT="sortorder"/>
         <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Sorting order of the columns" PREVIOUS="aggregationcoef" NEXT="display"/>
         <FIELD NAME="display" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="-1" SEQUENCE="false" ENUM="false" COMMENT="Display as real grades, percentages (in reference to the minimum and maximum grades) or letters (A, B, C etc..), or course default (-1)" PREVIOUS="sortorder" NEXT="decimals"/>
-        <FIELD NAME="decimals" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="2" SEQUENCE="false" ENUM="false" COMMENT="Also known as precision, the number of digits after the decimal point symbol." PREVIOUS="display" NEXT="hidden"/>
+        <FIELD NAME="decimals" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Also known as precision, the number of digits after the decimal point symbol." PREVIOUS="display" NEXT="hidden"/>
         <FIELD NAME="hidden" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="1 is hidden, &amp;gt; 1 is a date to hide until (prevents viewing)" PREVIOUS="decimals" NEXT="locked"/>
         <FIELD NAME="locked" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="1 is locked, &amp;gt; 1 is a date to lock until (prevents update)" PREVIOUS="hidden" NEXT="locktime"/>
         <FIELD NAME="locktime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="lock all final grades after this date" PREVIOUS="locked" NEXT="needsupdate"/>
index 5c1d2d730afc5e7935804c7a8d29eb28222f25c5..c7331fddfdca0b53b77cb3c9dac62b8ad4ced3ad 100644 (file)
@@ -2221,6 +2221,27 @@ function xmldb_main_upgrade($oldversion=0) {
         $result = $result && add_field($table, $field);
     }
 
+    if ($result && $oldversion < 2007092501) {
+
+    /// Changing the default of field decimals on table grade_items to drop it
+        $table = new XMLDBTable('grade_items');
+        $field = new XMLDBField('decimals');
+        $field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null, 'display');
+
+    /// Launch change of default for field decimals
+        $result = $result && change_field_default($table, $field);
+    }
+    if ($result && $oldversion < 2007092501) {
+
+    /// Changing nullability of field decimals on table grade_items to null
+        $table = new XMLDBTable('grade_items');
+        $field = new XMLDBField('decimals');
+        $field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null, 'display');
+
+    /// Launch change of nullability for field decimals
+        $result = $result && change_field_notnull($table, $field);
+    }
+
 /*
     /// drop old gradebook tables
     if ($result && $oldversion < xxxxxxxx) {
index 2b88fa2421b9f76968e7924cbe86fe659ba093a3..d47bb34a3cd447a5fa36c667bdf3509df80545c5 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2007092500;  // YYYYMMDD = date
+    $version = 2007092501;  // YYYYMMDD = date
                             //       XY = increments within a single day
 
     $release = '1.9 Beta +';   // Human-friendly version name