From b39b58fe459eadac004b473847546aaa5c4862af Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Tue, 25 Sep 2007 09:47:40 +0000 Subject: [PATCH] MDL-11433 Correcting non-null and default value (Default will be NULL) --- lib/db/install.xml | 2 +- lib/db/upgrade.php | 21 +++++++++++++++++++++ version.php | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/db/install.xml b/lib/db/install.xml index 223d5cb2cfc..5f8fef87f90 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1338,7 +1338,7 @@ - + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 5c1d2d730af..c7331fddfdc 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2221,6 +2221,27 @@ function xmldb_main_upgrade($oldversion=0) { $result = $result && add_field($table, $field); } + if ($result && $oldversion < 2007092501) { + + /// Changing the default of field decimals on table grade_items to drop it + $table = new XMLDBTable('grade_items'); + $field = new XMLDBField('decimals'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null, 'display'); + + /// Launch change of default for field decimals + $result = $result && change_field_default($table, $field); + } + if ($result && $oldversion < 2007092501) { + + /// Changing nullability of field decimals on table grade_items to null + $table = new XMLDBTable('grade_items'); + $field = new XMLDBField('decimals'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null, 'display'); + + /// Launch change of nullability for field decimals + $result = $result && change_field_notnull($table, $field); + } + /* /// drop old gradebook tables if ($result && $oldversion < xxxxxxxx) { diff --git a/version.php b/version.php index 2b88fa2421b..d47bb34a3cd 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2007092500; // YYYYMMDD = date + $version = 2007092501; // YYYYMMDD = date // XY = increments within a single day $release = '1.9 Beta +'; // Human-friendly version name