MDL-10821, making configdata nullable

This commit is contained in:
toyomoyo 2007-08-13 02:38:10 +00:00
parent f23dea666c
commit 32fe29c7f3
3 changed files with 20 additions and 3 deletions

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="blocks/db" VERSION="20060809" COMMENT="XMLDB file for Moodle block tables">
<XMLDB PATH="blocks/db" VERSION="20070813" COMMENT="XMLDB file for Moodle block tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="block" COMMENT="to store installed blocks" NEXT="block_instance">
<FIELDS>
@ -24,7 +27,7 @@
<FIELD NAME="position" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="pagetype" NEXT="weight"/>
<FIELD NAME="weight" TYPE="int" LENGTH="3" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="position" NEXT="visible"/>
<FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="weight" NEXT="configdata"/>
<FIELD NAME="configdata" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="visible"/>
<FIELD NAME="configdata" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="visible"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="blockid"/>

View File

@ -32,7 +32,21 @@ function xmldb_blocks_upgrade($oldversion=0) {
/// $result = result of "/lib/ddllib.php" function calls
/// }
if ($result && $oldversion < 2007081300) {
/// Changing nullability of field configdata on table block_instance to null
$table = new XMLDBTable('block_instance');
$field = new XMLDBField('configdata');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'visible');
/// Launch change of nullability for field configdata
$result = $result && change_field_notnull($table, $field);
}
return $result;
}
?>

View File

@ -5,4 +5,4 @@
// database (blocks_version) to determine whether upgrades should
// be performed (see db/backup_*.php)
$blocks_version = 2005090201; // The current version is a date (YYYYMMDDXX)
$blocks_version = 2007081300; // The current version is a date (YYYYMMDDXX)