]> git.mjollnir.org Git - moodle.git/commitdiff
fix for MDL-9095, increase blog tag length
authortoyomoyo <toyomoyo>
Wed, 4 Apr 2007 09:13:32 +0000 (09:13 +0000)
committertoyomoyo <toyomoyo>
Wed, 4 Apr 2007 09:13:32 +0000 (09:13 +0000)
lib/db/install.xml
lib/db/upgrade.php
version.php

index e95b9c7dd707cb1c5b3b027517b5128daa52d676..f363bf11bf4ce42b47b40cbfb46ccf5804c45687 100644 (file)
     <TABLE NAME="tags" COMMENT="tags structure for moodle" PREVIOUS="post" NEXT="blog_tag_instance">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="type"/>
-        <FIELD NAME="type" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="official" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="userid"/>
+        <FIELD NAME="type" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="official" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="userid"/>
         <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="type" NEXT="text"/>
-        <FIELD NAME="text" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid"/>
+        <FIELD NAME="text" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="userid"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for tags"/>
index 158bd408f66b034d662f149101cdf316a0334258..c166459be50fc524972e1cbac6b86718deaecb55 100644 (file)
@@ -667,6 +667,30 @@ function xmldb_main_upgrade($oldversion=0) {
         $result = $result && create_table($table);
     }
 
+
+    /// code to change lenghen tag field to 255, MDL-9095
+    if ($result && $oldversion < 2007040400) {
+
+    /// Define index text (not unique) to be dropped form tags
+        $table = new XMLDBTable('tags');
+        $index = new XMLDBIndex('text');
+        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('text'));
+
+    /// Launch drop index text
+        $result = $result && drop_index($table, $index);
+           
+        $field = new XMLDBField('text');
+        $field->setAttributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null, 'userid');
+
+    /// Launch change of type for field text
+        $result = $result && change_field_type($table, $field);
+        
+        $index = new XMLDBIndex('text');
+        $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('text'));
+
+    /// Launch add index text
+        $result = $result && add_index($table, $index);       
+    }
     return $result;
 
 }
index 8e5fbb626b711dec9b8d7ed5300459bff426ba67..28e6e7f4667bf12c895e524723caced83e31fb4c 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 = 2007040200;  // YYYYMMDD = date
+   $version = 2007040400;  // YYYYMMDD = date
                            //       XY = increments within a single day
 
    $release = '1.9 dev';    // Human-friendly version name