]> git.mjollnir.org Git - moodle.git/commitdiff
Don't rely on index names to decide if we have to drop one key
authorstronk7 <stronk7>
Thu, 28 Sep 2006 22:05:11 +0000 (22:05 +0000)
committerstronk7 <stronk7>
Thu, 28 Sep 2006 22:05:11 +0000 (22:05 +0000)
lib/ddllib.php

index cf4b32e4710dab7acf59eede95c2f29ddbe3445b..4922864417aae1a30c407a05773654bd7b3c390f 100644 (file)
@@ -608,15 +608,6 @@ function add_key($table, $key, $continue=true, $feedback=true) {
         return true;
     }
 
-/// Check there isn't any index with the same fields
-/// if it exists we don't create the key
-    $index = new XMLDBIndex('anyname');
-    $index->setAttributes(XMLDB_INDEX_UNIQUE, $key->getFields());
-    if ($indexexists = find_index_name($table, $index)) {
-    /// TODO print some notify here (id debuglevel is DEVELOPER)
-        return true; //Index exists, nothing to do
-    }
-
     if(!$sqlarr = $table->getAddKeySQL($CFG->dbtype, $CFG->prefix, $key, false)) {
         return true; //Empty array = nothing to do = no error
     }
@@ -651,15 +642,6 @@ function drop_key($table, $key, $continue=true, $feedback=true) {
         return true;
     }
 
-/// Check there is one index with the same fields
-/// if it exists we'll drop the key
-    $index = new XMLDBIndex('anyname');
-    $index->setAttributes(XMLDB_INDEX_UNIQUE, $key->getFields());
-    if (!$indexexists = find_index_name($table, $index)) {
-    /// TODO print some notify here (id debuglevel is DEVELOPER)
-        return true; //Index exists, nothing to do
-    }
-
     if(!$sqlarr = $table->getDropKeySQL($CFG->dbtype, $CFG->prefix, $key, false)) {
         return true; //Empty array = nothing to do = no error
     }
@@ -739,7 +721,6 @@ function drop_index($table, $index, $continue=true, $feedback=true) {
         return true; //Empty array = nothing to do = no error
     }
 
-
     return execute_sql_arr($sqlarr, $continue, $feedback);
 }