MDl-29189 course Increased the shortname field length so that it is more usable now that it is consistently formatted

This commit is contained in:
Sam Hemelryk 2011-09-07 12:33:23 +12:00
parent 8ebbb06adf
commit efd9c8e5b6
3 changed files with 30 additions and 3 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20110821" COMMENT="XMLDB file for core Moodle tables"
<XMLDB PATH="lib/db" VERSION="20110907" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@ -73,7 +73,7 @@
<FIELD NAME="category" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="sortorder"/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="category" NEXT="fullname"/>
<FIELD NAME="fullname" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" PREVIOUS="sortorder" NEXT="shortname"/>
<FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="fullname" NEXT="idnumber"/>
<FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="fullname" NEXT="idnumber"/>
<FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="shortname" NEXT="summary"/>
<FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="idnumber" NEXT="summaryformat"/>
<FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="summary" NEXT="format"/>

View file

@ -6696,6 +6696,33 @@ FROM
upgrade_main_savepoint(true, 2011083100.02);
}
if ($oldversion < 2011090800) {
// Increase the length of the of the course shortname field as it is now going
// to be consistently filtered and 100 characters if practically useless for
// things like the multilang filter.
$table = new xmldb_table('course');
$field = new xmldb_field('shortname', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'fullname');
$index = new xmldb_index('shortname', XMLDB_INDEX_NOTUNIQUE, array('shortname'));
// First check the shortname field exists... pretty heavy mod if it doesnt!
if ($dbman->field_exists($table, $field)) {
// Conditionally launch drop index shortname, this is required to happen
// before we can edit the field.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}
// Launch change of precision for field shortname
$dbman->change_field_precision($table, $field);
// Add the index back to the table now that we're finished our mods
$dbman->add_index($table, $index);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2011090800);
}
return true;
}

View file

@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
$version = 2011090700.00; // YYYYMMDD = weekly release date of this DEV branch
$version = 2011090800.00; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes