fix for MDL-9095, increase blog tag length

This commit is contained in:
toyomoyo 2007-04-04 09:13:32 +00:00
parent 97e7e624f7
commit 07076b70a4
3 changed files with 27 additions and 3 deletions

View File

@ -768,9 +768,9 @@
<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"/>

View 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;
}

View 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