浏览代码

Create the UUID index on the right table as well as on table creation

zreed 11 年之前
父节点
当前提交
16b40c3eba
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java

+ 3 - 2
src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java

@@ -962,7 +962,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
                     + "`uuid` varchar(36) NULL DEFAULT NULL,"
                     + "`uuid` varchar(36) NULL DEFAULT NULL,"
                     + "`lastlogin` int(32) unsigned NOT NULL,"
                     + "`lastlogin` int(32) unsigned NOT NULL,"
                     + "PRIMARY KEY (`id`),"
                     + "PRIMARY KEY (`id`),"
-                    + "UNIQUE KEY `user` (`user`)) DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
+                    + "UNIQUE KEY `user` (`user`)"
+                    + "UNIQUE KEY `uuid` (`uuid`)) DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
             statement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` ("
             statement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` ("
                     + "`user_id` int(10) unsigned NOT NULL,"
                     + "`user_id` int(10) unsigned NOT NULL,"
                     + "`mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "',"
                     + "`mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "',"
@@ -1331,7 +1332,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
             if (!column_exists) {
             if (!column_exists) {
                 mcMMO.p.getLogger().info("Adding UUIDs to mcMMO MySQL user table...");
                 mcMMO.p.getLogger().info("Adding UUIDs to mcMMO MySQL user table...");
                 statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD `uuid` varchar(36) NULL DEFAULT NULL");
                 statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD `uuid` varchar(36) NULL DEFAULT NULL");
-                statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD UNIQUE INDEX `idx_uuid` (`uuid`) USING BTREE");
+                statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD UNIQUE INDEX `uuid` (`uuid`) USING BTREE");
             }
             }
         } catch (SQLException ex) {
         } catch (SQLException ex) {
             printErrors(ex);
             printErrors(ex);