Browse Source

Update DB\Mysql

Visman 3 năm trước cách đây
mục cha
commit
9902e302a5
1 tập tin đã thay đổi với 3 bổ sung10 xóa
  1. 3 10
      app/Core/DB/Mysql.php

+ 3 - 10
app/Core/DB/Mysql.php

@@ -447,15 +447,10 @@ class Mysql
         if ('PRIMARY' == $index) {
             $query .= 'PRIMARY KEY';
         } else {
-            $index = $table . '_' . $index;
-
             $this->nameCheck($index);
 
-            if ($unique) {
-                $query .= "UNIQUE `{$index}`";
-            } else {
-                $query .= "INDEX `{$index}`";
-            }
+            $type   = $unique ? 'UNIQUE' : 'INDEX';
+            $query .= "{$type} `{$table}_{$index}`";
         }
 
         $query .= ' (' . $this->replIdxs($fields) . ')';
@@ -479,11 +474,9 @@ class Mysql
         if ('PRIMARY' == $index) {
             $query .= "PRIMARY KEY";
         } else {
-            $index = $table . '_' . $index;
-
             $this->nameCheck($index);
 
-            $query .= "INDEX `{$index}`";
+            $query .= "INDEX `{$table}_{$index}`";
         }
 
         return false !== $this->db->exec($query);