From 4149e289b6b95f14ad111c7caffeb05d5a7a4a2d Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 28 Aug 2007 18:27:00 +0000 Subject: [PATCH] Fix mnet_hosts->applicationid (from 1 to 10). MDL-11042 --- lib/db/upgrade.php | 28 ++++++++++++++++++++++++++++ version.php | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index e3c0c76f3a..fcf1380825 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1963,6 +1963,34 @@ function xmldb_main_upgrade($oldversion=0) { $result = $result && create_table($table); } +/// Going to modify the applicationid from int(1) to int(10). Dropping and +/// re-creating the associated keys/indexes is mandatory to be cross-db. MDL-11042 + if ($result && $oldversion < 2007082803) { + + /// Define key applicationid (foreign) to be dropped form mnet_host + $table = new XMLDBTable('mnet_host'); + $key = new XMLDBKey('applicationid'); + $key->setAttributes(XMLDB_KEY_FOREIGN, array('applicationid'), 'mnet_application', array('id')); + + /// Launch drop key applicationid + $result = $result && drop_key($table, $key); + + /// Changing type of field applicationid on table mnet_host to int + $field = new XMLDBField('applicationid'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '1', 'last_log_id'); + + /// Launch change of type for field applicationid + $result = $result && change_field_type($table, $field); + + /// Define key applicationid (foreign) to be added to mnet_host + $key = new XMLDBKey('applicationid'); + $key->setAttributes(XMLDB_KEY_FOREIGN, array('applicationid'), 'mnet_application', array('id')); + + /// Launch add key applicationid + $result = $result && add_key($table, $key); + + } + return $result; } diff --git a/version.php b/version.php index a67bdd0684..a723934a0d 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 = 2007082801; // YYYYMMDD = date + $version = 2007082803; // YYYYMMDD = date // XY = increments within a single day $release = '1.9 Beta +'; // Human-friendly version name -- 2.39.5