Ignore name of primary keys during creation (#3921)
authorMatthias Schmidt <gravatronics@live.com>
Tue, 2 Feb 2021 12:26:09 +0000 (13:26 +0100)
committerGitHub <noreply@github.com>
Tue, 2 Feb 2021 12:26:09 +0000 (13:26 +0100)
wcfsetup/install/files/lib/system/database/editor/MySQLDatabaseEditor.class.php

index 80b7e0667b476ab3f8fddf765ab668047540f310..97ee7bec1838ff02457e328cc23fb12a9c393bff 100644 (file)
@@ -402,7 +402,10 @@ class MySQLDatabaseEditor extends DatabaseEditor {
                else $definition = "KEY";
                
                // index name
-               if (!empty($indexName)) $definition .= " `".$indexName."`";
+               if (!empty($indexName) && $indexData['type'] !== 'PRIMARY') {
+                       $definition .= " `".$indexName."`";
+               }
+               
                // columns
                $definition .= " (`".str_replace(',', '`,`', preg_replace('/\s+/', '', $indexData['columns']))."`)";