]> git.mjollnir.org Git - moodle.git/commitdiff
Fix mnet_hosts->applicationid (from 1 to 10). MDL-11042
authorstronk7 <stronk7>
Tue, 28 Aug 2007 18:27:00 +0000 (18:27 +0000)
committerstronk7 <stronk7>
Tue, 28 Aug 2007 18:27:00 +0000 (18:27 +0000)
lib/db/upgrade.php
version.php

index e3c0c76f3abb4d5dd04677d0f61d76651708076d..fcf13808255af00e661230ffb723079339289237 100644 (file)
@@ -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;
 }
 
index a67bdd068431667846420b776c9cc5434d930bab..a723934a0dc789bd4ea3d9e43e7e6c663e7f5e8b 100644 (file)
@@ -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