]> git.mjollnir.org Git - moodle.git/commitdiff
minor adjust. keytype to drop keys is not needed anymore. now it's
authorstronk7 <stronk7>
Thu, 28 Sep 2006 21:47:36 +0000 (21:47 +0000)
committerstronk7 <stronk7>
Thu, 28 Sep 2006 21:47:36 +0000 (21:47 +0000)
defined in mysql generator (the only one needing it)

lib/xmldb/classes/generators/XMLDBGenerator.class.php
lib/xmldb/classes/generators/mysql/mysql.class.php

index 15b8f667b90593826b662c7dc6dd57c20108f6ef..e12b975a3bb756834ce11b1bf35aa83465d00c75 100644 (file)
@@ -66,13 +66,13 @@ class XMLDBgenerator {
     var $foreign_keys = false; // Does the generator build foreign keys
 
     var $drop_primary_key = 'ALTER TABLE TABLENAME DROP CONSTRAINT KEYNAME'; // Template to drop PKs
-                               // with automatic replace for TABLENAME, KEYTYPE and KEYNAME
+                               // with automatic replace for TABLENAME and KEYNAME
 
     var $drop_unique_key = 'ALTER TABLE TABLENAME DROP CONSTRAINT KEYNAME'; // Template to drop UKs
-                               // with automatic replace for TABLENAME, KEYTYPE and KEYNAME
+                               // with automatic replace for TABLENAME and KEYNAME
 
     var $drop_foreign_key = 'ALTER TABLE TABLENAME DROP CONSTRAINT KEYNAME'; // Template to drop FKs
-                               // with automatic replace for TABLENAME, KEYTYPE and KEYNAME
+                               // with automatic replace for TABLENAME and KEYNAME
 
     var $sequence_extra_code = true; //Does the generator need to add extra code to generate the sequence fields
     var $sequence_name = 'auto_increment'; //Particular name for inline sequences in this generator
@@ -656,14 +656,12 @@ class XMLDBgenerator {
             case XMLDB_KEY_PRIMARY:
                 if ($this->primary_keys) {
                     $template = $this->drop_primary_key;
-                    $keytype = 'PRIMARY';
                     $dropkey = true;
                 }
                 break;
             case XMLDB_KEY_UNIQUE:
                 if ($this->unique_keys) {
                     $template = $this->drop_unique_key;
-                    $keytype = 'UNIQUE';
                     $dropkey = true;
                 }
                 break;
@@ -671,7 +669,6 @@ class XMLDBgenerator {
             case XMLDB_KEY_FOREIGN:
                 if ($this->foreign_keys) {
                     $template = $this->drop_foreign_key;
-                    $keytype = 'FOREIGN KEY';
                     $dropkey = true;
                 }
                 break;
@@ -680,7 +677,6 @@ class XMLDBgenerator {
         if ($dropkey) {
         /// Replace TABLENAME, CONSTRAINTTYPE and KEYNAME as needed
             $dropsql = str_replace('TABLENAME', $this->getEncQuoted($this->prefix . $xmldb_table->getName()), $template);
-            $dropsql = str_replace('KEYTYPE', $keytype, $dropsql);
             $dropsql = str_replace('KEYNAME', $dbkeyname, $dropsql);
 
             $results[] = $dropsql;
index e8e3896affb5a543f803dcd7d96c8e2289bed26b..89865a2358c716ec40455b6f7cb38d39702b04b8 100644 (file)
@@ -41,14 +41,14 @@ class XMLDBmysql extends XMLDBGenerator {
 
     var $primary_key_name = ''; //To force primary key names to one string (null=no force)
 
-    var $drop_primary_key = 'ALTER TABLE TABLENAME DROP KEYTYPE KEYNAME'; // Template to drop PKs
-                // with automatic replace for TABLENAME, KEYTYPE and KEYNAME
+    var $drop_primary_key = 'ALTER TABLE TABLENAME DROP PRIMARY KEY'; // Template to drop PKs
+                // with automatic replace for TABLENAME and KEYNAME
 
-    var $drop_unique_key = 'ALTER TABLE TABLENAME DROP KEYTYPE KEYNAME'; // Template to drop UKs
-                // with automatic replace for TABLENAME, KEYTYPE and KEYNAME
+    var $drop_unique_key = 'ALTER TABLE TABLENAME DROP KEY KEYNAME'; // Template to drop UKs
+                // with automatic replace for TABLENAME and KEYNAME
 
-    var $drop_foreign_key = 'ALTER TABLE TABLENAME DROP KEYTYPE KEYNAME'; // Template to drop FKs
-                // with automatic replace for TABLENAME, KEYTYPE and KEYNAME
+    var $drop_foreign_key = 'ALTER TABLE TABLENAME DROP FOREIGN KEY KEYNAME'; // Template to drop FKs
+                // with automatic replace for TABLENAME and KEYNAME
 
     var $sequence_extra_code = false; //Does the generator need to add extra code to generate the sequence fields
     var $sequence_name = 'auto_increment'; //Particular name for inline sequences in this generator