MDL-9506 Added timestamps to grade_categories
authornicolasconnault <nicolasconnault>
Thu, 26 Apr 2007 03:23:45 +0000 (03:23 +0000)
committernicolasconnault <nicolasconnault>
Thu, 26 Apr 2007 03:23:45 +0000 (03:23 +0000)
lib/db/install.xml
lib/db/upgrade.php

index dbbdf928ba499030b5223b723adefd17813fa5fd..dec9959b3d8b5f823caa380e0c6b9e2b8ee6557d 100644 (file)
         <FIELD NAME="aggregation" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="A constant pointing to one of the predefined aggregation strategies (none, mean,median,sum, etc)" PREVIOUS="fullname" NEXT="keephigh"/>
         <FIELD NAME="keephigh" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Keep only the X highest items" PREVIOUS="aggregation" NEXT="droplow"/>
         <FIELD NAME="droplow" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Drop the X lowest items" PREVIOUS="keephigh" 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" PREVIOUS="droplow"/>
+        <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" PREVIOUS="droplow" NEXT="timecreated"/>
+        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="hidden" NEXT="timemodified"/>
+        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me" NEXT="courseid"/>
index bbb0dd33d48c91c12010f7d32c0565f0c22f0e64..88cf92b33925e2dce36079dd4bb5a1d1d94dd21f 100644 (file)
@@ -1000,7 +1000,24 @@ function xmldb_main_upgrade($oldversion=0) {
         $result = $result && create_table($table);        
     }
 
-    
+    if ($result && $oldversion < 2007042600) {
+
+        /// Define field timecreated to be added to grade_categories
+        $table = new XMLDBTable('grade_categories');
+        $field = new XMLDBField('timecreated');
+        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'hidden');
+
+        /// Launch add field timecreated
+        $result = $result && add_field($table, $field);
+
+        /// Define field timemodified to be added to grade_categories
+        $table = new XMLDBTable('grade_categories');
+        $field = new XMLDBField('timemodified');
+        $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'timecreated');
+
+        /// Launch add field timemodified
+        $result = $result && add_field($table, $field);
+    }
     
     return $result;