MDL-13766, new field for repository table
authordongsheng <dongsheng>
Thu, 7 Aug 2008 07:48:14 +0000 (07:48 +0000)
committerdongsheng <dongsheng>
Thu, 7 Aug 2008 07:48:14 +0000 (07:48 +0000)
lib/db/install.xml
lib/db/upgrade.php
version.php

index 82849ca627f5336b94f1df24a9522c080f1edfa3..f3b6714e36fdc0b0f9c8761e1edbcb00709bfce2 100644 (file)
         <FIELD NAME="data5" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="data4" NEXT="timecreated"/>
         <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="data5" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated"/>
+        <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="timemodified"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
       </SENTENCES>
     </STATEMENT>
   </STATEMENTS>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
index cf219adcefd05d5ee0f4d6e9e74c5a0bd9904165..0d6694d8ef0c8351033b07e616d343d1b502099a 100644 (file)
@@ -610,6 +610,20 @@ function xmldb_main_upgrade($oldversion=0) {
     /// Main savepoint reached
         upgrade_main_savepoint($result, 2008080600);
     }
+    if ($result && $oldversion < 2008080701) {
+
+    /// Define field visible to be added to repository
+        $table = new xmldb_table('repository');
+        $field = new xmldb_field('visible', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, '1', 'timemodified');
+
+    /// Conditionally launch add field visible
+        if (!$dbman->field_exists($table, $field)) {
+            $dbman->add_field($table, $field);
+        }
+
+    /// Main savepoint reached
+        upgrade_main_savepoint($result, 2008080701);
+    }
 
     return $result;
 }
index 0ad46ce0fab051cd4f151b1c55338b5c218254d3..bcc1213d6b6092a234d4a018d29bacfb3ee64c2f 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 = 2008080600;  // YYYYMMDD   = date of the last version bump
+    $version = 2008080701;  // YYYYMMDD   = date of the last version bump
                             //         XX = daily increments
 
     $release = '2.0 dev (Build: 20080807)';  // Human-friendly version name