Now group->description and groups_groupings->description are NULLable

Also, some incorrect default values are out (XMLDB handles them).

MDL-7356 & MDL-8239
This commit is contained in:
stronk7 2007-01-20 18:59:22 +00:00
parent 8dc0648057
commit 26a1b2f35b
4 changed files with 27 additions and 17 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="group/db" VERSION="20061209" COMMENT="XMLDB file for Moodle groups." <XMLDB PATH="group/db" VERSION="20070120" COMMENT="XMLDB file for Moodle groups."
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd" xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
> >
@ -8,10 +8,10 @@
<FIELDS> <FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="name"/> <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Short human readable unique name for the group." PREVIOUS="id" NEXT="description"/> <FIELD NAME="name" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Short human readable unique name for the group." PREVIOUS="id" NEXT="description"/>
<FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="true" DEFAULT="" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="enrolmentkey"/> <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="enrolmentkey"/>
<FIELD NAME="enrolmentkey" TYPE="char" LENGTH="50" NOTNULL="true" DEFAULT="" SEQUENCE="false" ENUM="false" PREVIOUS="description" NEXT="lang"/> <FIELD NAME="enrolmentkey" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="description" NEXT="lang"/>
<FIELD NAME="lang" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="en" SEQUENCE="false" ENUM="false" PREVIOUS="enrolmentkey" NEXT="theme"/> <FIELD NAME="lang" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="en" SEQUENCE="false" ENUM="false" PREVIOUS="enrolmentkey" NEXT="theme"/>
<FIELD NAME="theme" TYPE="char" LENGTH="50" NOTNULL="true" DEFAULT="" SEQUENCE="false" ENUM="false" PREVIOUS="lang" NEXT="picture"/> <FIELD NAME="theme" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="lang" NEXT="picture"/>
<FIELD NAME="picture" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="theme" NEXT="hidepicture"/> <FIELD NAME="picture" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="theme" NEXT="hidepicture"/>
<FIELD NAME="hidepicture" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="picture" NEXT="timecreated"/> <FIELD NAME="hidepicture" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="picture" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="hidepicture" NEXT="timemodified"/> <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="hidepicture" NEXT="timemodified"/>
@ -40,7 +40,7 @@
<FIELDS> <FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="name"/> <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Short human readable unique name for group." PREVIOUS="id" NEXT="description"/> <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Short human readable unique name for group." PREVIOUS="id" NEXT="description"/>
<FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="true" DEFAULT="" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="timecreated"/> <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="description" NEXT="viewowngroup"/> <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="description" NEXT="viewowngroup"/>
<FIELD NAME="viewowngroup" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated" NEXT="viewallgroupsmembers"/> <FIELD NAME="viewowngroup" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated" NEXT="viewallgroupsmembers"/>
<FIELD NAME="viewallgroupsmembers" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="viewowngroup" NEXT="viewallgroupsactivities"/> <FIELD NAME="viewallgroupsmembers" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="viewowngroup" NEXT="viewallgroupsactivities"/>
@ -93,4 +93,4 @@
</SENTENCES> </SENTENCES>
</STATEMENT> </STATEMENT>
</STATEMENTS> </STATEMENTS>
</XMLDB> </XMLDB>

View file

@ -211,16 +211,26 @@ function xmldb_group_upgrade($oldversion=0) {
$result = true; $result = true;
/// And upgrade begins here. For each one, you'll need one if ($result && $oldversion < 2007012000) {
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php /// Changing nullability of field description on table groups to null
/// $result = result of "/lib/ddllib.php" function calls $table = new XMLDBTable('groups');
/// } $field = new XMLDBField('description');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'name');
/// Launch change of nullability for field description
$result = $result && change_field_notnull($table, $field);
/// Changing nullability of field description on table groups_groupings to null
$table = new XMLDBTable('groups_groupings');
$field = new XMLDBField('description');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'name');
/// Launch change of nullability for field description
$result = $result && change_field_notnull($table, $field);
}
return $result; return $result;
} }
?> ?>

View file

@ -11,7 +11,7 @@
require_once('../config.php'); require_once('../config.php');
require_once('lib.php'); require_once('lib.php');
require_once($CFG->libdir.'/moodlelib.php'); require_once($CFG->libdir.'/moodlelib.php');
require_once($CFG->libdir.'/json/JSON.php'); //require_once($CFG->libdir.'/json/JSON.php');
$success = true; $success = true;
@ -273,4 +273,4 @@ if ($success) {
print_footer($course); print_footer($course);
} }
?> ?>

View file

@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php // This fragment is called by /admin/index.php
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
$group_version = 2006120401; $group_version = 2007012000;
//$module->requires = 2006120400; // Requires this Moodle version //$module->requires = 2006120400; // Requires this Moodle version
?> ?>