From: stronk7 Date: Sat, 2 Sep 2006 22:37:38 +0000 (+0000) Subject: course_sections->summary and course_sections->sequence can be NULLable (experimenting... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1331745826732b0ded9b467e9c362bdaba63638a;p=moodle.git course_sections->summary and course_sections->sequence can be NULLable (experimenting....) --- diff --git a/lib/db/install.xml b/lib/db/install.xml index 3ad89ee214..b07893ffba 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,5 +1,5 @@ - @@ -157,8 +157,8 @@ - - + + diff --git a/lib/db/mysql.php b/lib/db/mysql.php index b0e3c18c19..eae85f8967 100644 --- a/lib/db/mysql.php +++ b/lib/db/mysql.php @@ -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; } diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index d67d027561..a82e0adcb5 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -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) diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php index 71fdcfa492..7b5111a240 100644 --- a/lib/db/postgres7.php +++ b/lib/db/postgres7.php @@ -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; } diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql index 4c0295306b..65f752fb8d 100644 --- a/lib/db/postgres7.sql +++ b/lib/db/postgres7.sql @@ -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' );