Suppress error if added column already exists

This commit is contained in:
Georg 2015-03-17 16:44:22 +01:00
parent 50a2936b8d
commit 2c73e5d33e
3 changed files with 5 additions and 29 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>MinePacks</artifactId>
<version>1.2</version>
<version>1.2.1</version>
<repositories>
<repository>
<id>in-project</id>

View File

@ -114,26 +114,14 @@ private void CheckDB()
{
stmt.execute("ALTER TABLE `" + Table_Players + "` ADD COLUMN `uuid` CHAR(32) UNIQUE;");
}
catch(SQLException e)
{
if(e.getErrorCode() != 1060)
{
e.printStackTrace();
}
}
catch(SQLException e) { }
}
stmt.execute("CREATE TABLE IF NOT EXISTS `" + Table_Backpacks + "` (`owner` INT UNSIGNED NOT NULL, `itemstacks` BLOB, PRIMARY KEY (`owner`));");
try
{
stmt.execute("ALTER TABLE `" + Table_Backpacks + "` ADD COLUMN `version` INT DEFAULT 0;");
}
catch(SQLException e)
{
if(e.getErrorCode() != 1060)
{
e.printStackTrace();
}
}
catch(SQLException e) { }
stmt.close();
}
catch (SQLException e)

View File

@ -120,26 +120,14 @@ private void CheckDB()
{
stmt.execute("ALTER TABLE `" + Table_Players + "` ADD COLUMN `uuid` CHAR(32) UNIQUE;");
}
catch(SQLException e)
{
if(e.getErrorCode() != 1060)
{
e.printStackTrace();
}
}
catch(SQLException e) { }
}
stmt.execute("CREATE TABLE IF NOT EXISTS `" + Table_Backpacks + "` (`owner` INT UNSIGNED PRIMARY KEY, `itemstacks` BLOB);");
try
{
stmt.execute("ALTER TABLE `" + Table_Backpacks + "` ADD COLUMN `version` INT DEFAULT 0;");
}
catch(SQLException e)
{
if(e.getErrorCode() != 1060)
{
e.printStackTrace();
}
}
catch(SQLException e) { }
stmt.close();
}
catch (SQLException e)