mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-03 18:47:43 +01:00
Fix create statements
This commit is contained in:
parent
1a6c664719
commit
f4b816b24f
8
pom.xml
8
pom.xml
@ -6,13 +6,13 @@
|
||||
<version>1.17.8-SNAPSHOT</version>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:GeorgH93/Bukkit_Minepacks.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:GeorgH93/Bukkit_Minepacks.git</developerConnection>
|
||||
<url>git@github.com:GeorgH93/Bukkit_Minepacks.git</url>
|
||||
<connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:GeorgH93/Minepacks.git</developerConnection>
|
||||
<url>git@github.com:GeorgH93/Minepacks.git</url>
|
||||
</scm>
|
||||
<issueManagement>
|
||||
<system>GitHub</system>
|
||||
<url>https://github.com/GeorgH93/Bukkit_Minepacks/issues</url>
|
||||
<url>https://github.com/GeorgH93/Minepacks/issues</url>
|
||||
</issueManagement>
|
||||
<ciManagement>
|
||||
<system>jenkins</system>
|
||||
|
@ -23,9 +23,7 @@
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
public class MySQL extends SQL
|
||||
{
|
||||
@ -56,18 +54,20 @@ protected void updateQuerysForDialect()
|
||||
@Override
|
||||
protected void checkDB()
|
||||
{
|
||||
try(Connection connection = getConnection(); Statement stmt = connection.createStatement())
|
||||
try(Connection connection = getConnection())
|
||||
{
|
||||
if(useUUIDs)
|
||||
{
|
||||
DBTools.updateDB(connection, "CREATE TABLE IF NOT EXISTS `" + tablePlayers + "` (`" + fieldPlayerID + "` INT UNSIGNED NOT NULL AUTO_INCREMENT,`" + fieldName + "` CHAR(16) NOT NULL,`" + fieldUUID + "` CHAR(36) UNIQUE, PRIMARY KEY (`" + fieldPlayerID + "`));");
|
||||
DBTools.updateDB(connection, "CREATE TABLE `" + tablePlayers + "` (\n`" + fieldPlayerID + "` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n`" + fieldName + "` CHAR(16) NOT NULL,\n`"
|
||||
+ fieldUUID + "` CHAR(36) DEFAULT NULL,\nPRIMARY KEY (`" + fieldPlayerID + "`),\nUNIQUE INDEX `" + fieldUUID + "_UNIQUE` (`" + fieldUUID + "`)\n);");
|
||||
}
|
||||
else
|
||||
{
|
||||
DBTools.updateDB(connection, "CREATE TABLE IF NOT EXISTS `" + tablePlayers + "` (`" + fieldPlayerID + "` INT UNSIGNED NOT NULL AUTO_INCREMENT,`" + fieldName + "` CHAR(16) NOT NULL UNIQUE, PRIMARY KEY (`" + fieldPlayerID + "`));");
|
||||
DBTools.updateDB(connection, "CREATE TABLE `" + tablePlayers + "` (\n`" + fieldPlayerID + "` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n`" + fieldName + "` CHAR(16) NOT NULL,\n"
|
||||
+ "PRIMARY KEY (`" + fieldPlayerID + "`),\nUNIQUE INDEX `" + fieldName + "_UNIQUE` (`" + fieldName + "`)\n);");
|
||||
}
|
||||
DBTools.updateDB(connection, "CREATE TABLE IF NOT EXISTS `" + tableBackpacks + "` (`" + fieldBPOwner + "` INT UNSIGNED NOT NULL, `" + fieldBPITS + "` BLOB, `"
|
||||
+ fieldBPVersion + "` INT DEFAULT 0, " + ((maxAge > 0) ? "`" + fieldBPLastUpdate + "` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, " : "") + "PRIMARY KEY (`" + fieldBPOwner + "`));");
|
||||
DBTools.updateDB(connection, "CREATE TABLE `" + tableBackpacks + "` (\n`" + fieldBPOwner + "` INT UNSIGNED NOT NULL,\n`" + fieldBPITS + "` BLOB,\n`"
|
||||
+ fieldBPVersion + "` INT DEFAULT 0,\n" + ((maxAge > 0) ? "`" + fieldBPLastUpdate + "` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n" : "") + "PRIMARY KEY (`" + fieldBPOwner + "`)\n);");
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user