]> git.mjollnir.org Git - moodle.git/commitdiff
course_sections->summary and course_sections->sequence can be NULLable (experimenting...
authorstronk7 <stronk7>
Sat, 2 Sep 2006 22:37:38 +0000 (22:37 +0000)
committerstronk7 <stronk7>
Sat, 2 Sep 2006 22:37:38 +0000 (22:37 +0000)
lib/db/install.xml
lib/db/mysql.php
lib/db/mysql.sql
lib/db/postgres7.php
lib/db/postgres7.sql

index 3ad89ee214299c1a8fc7f89873f64ba0540194b4..b07893ffbaacd2cd2badfeed9c4448546ed3ffff 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20060901" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20060902" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="course"/>
         <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="section"/>
         <FIELD NAME="section" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="summary"/>
-        <FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="section" NEXT="sequence"/>
-        <FIELD NAME="sequence" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="summary" NEXT="visible"/>
+        <FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="section" NEXT="sequence"/>
+        <FIELD NAME="sequence" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="summary" NEXT="visible"/>
         <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="false" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="sequence"/>
       </FIELDS>
       <KEYS>
index b0e3c18c19b0f6de134bf17d47e11dcf3fc3f411..eae85f8967f855dc63f7beee1b4640ec0d31d536 100644 (file)
@@ -2181,6 +2181,11 @@ function main_upgrade($oldversion=0) {
         execute_sql("ALTER TABLE {$CFG->prefix}user CHANGE description description text NULL AFTER url");
     }
 
+    if ($oldversion < 2006090200) {
+        execute_sql("ALTER TABLE {$CFG->prefix}course_sections CHANGE summary summary text NULL AFTER section");
+        execute_sql("ALTER TABLE {$CFG->prefix}course_sections CHANGE sequence sequence text NULL AFTER section");
+    }
+
     return $result;
 }
 
index d67d027561b9ecd9a8bf5590dbda8ce606894124..a82e0adcb5d00908ec85c25e2edc7ebd03b357fa 100644 (file)
@@ -178,8 +178,8 @@ CREATE TABLE `prefix_course_sections` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `course` int(10) unsigned NOT NULL default '0',
   `section` int(10) unsigned NOT NULL default '0',
-  `summary` text NOT NULL default '',
-  `sequence` text NOT NULL default '',
+  `summary` text,
+  `sequence` text,
   `visible` tinyint(1) NOT NULL default '1',
   PRIMARY KEY  (`id`),
   KEY `coursesection` (course,section)
index 71fdcfa492ebc6994c5ecec2d4c32f53947175de..7b5111a240acf9a2fbef2fdd8b9b7022d6c880ba 100644 (file)
@@ -1779,6 +1779,13 @@ function main_upgrade($oldversion=0) {
         execute_sql("ALTER TABLE {$CFG->prefix}user ALTER COLUMN description DROP DEFAULT");
     }
 
+    if ($oldversion < 2006090200) {
+        execute_sql("ALTER TABLE {$CFG->prefix}course_sections ALTER COLUMN summary DROP NOT NULL");
+        execute_sql("ALTER TABLE {$CFG->prefix}course_sections ALTER COLUMN summary DROP DEFAULT");
+        execute_sql("ALTER TABLE {$CFG->prefix}course_sections ALTER COLUMN sequence DROP NOT NULL");
+        execute_sql("ALTER TABLE {$CFG->prefix}course_sections ALTER COLUMN sequence DROP DEFAULT");
+    }
+
     return $result;
 }
 
index 4c0295306bd2f4469dd88c0c7d477ac690c63135..65f752fb8de7f58706c07bc5d88ee169d1d80202 100644 (file)
@@ -117,8 +117,8 @@ CREATE TABLE prefix_course_sections (
    id SERIAL PRIMARY KEY,
    course integer NOT NULL default '0',
    section integer NOT NULL default '0',
-   summary text NOT NULL default '',
-   sequence text NOT NULL default '',
+   summary text,
+   sequence text,
    visible integer NOT NULL default '1'
 );