mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-21 21:31:34 +01:00
Some cleanups
This commit is contained in:
parent
e91daa9b75
commit
5dcbcc6a05
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 GeorgH93
|
||||
* Copyright (C) 2020 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -28,7 +28,6 @@
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
@ -84,16 +83,15 @@ protected void checkDB()
|
||||
stmt.execute("ALTER TABLE `backpack_players` ADD COLUMN `uuid` CHAR(32);");
|
||||
}
|
||||
catch(SQLException ignored) {}
|
||||
stmt.execute("CREATE TABLE IF NOT EXISTS `backpacks` (`owner` INT UNSIGNED PRIMARY KEY, `itemstacks` BLOB, `version` INT DEFAULT 0);");
|
||||
stmt.execute("CREATE TABLE IF NOT EXISTS `backpacks` (`owner` INT UNSIGNED PRIMARY KEY, `itemstacks` BLOB, `version` INT DEFAULT 0, `lastupdate` DATE DEFAULT CURRENT_DATE);");
|
||||
try
|
||||
{
|
||||
stmt.execute("ALTER TABLE `backpacks` ADD COLUMN `version` INT DEFAULT 0;");
|
||||
}
|
||||
catch(SQLException ignored) {}
|
||||
try(ResultSet rs = stmt.executeQuery("SELECT DATE('now');"))
|
||||
try
|
||||
{
|
||||
rs.next();
|
||||
stmt.execute("ALTER TABLE `backpacks` ADD COLUMN `lastupdate` DATE DEFAULT '" + rs.getString(1) + "';");
|
||||
stmt.execute("ALTER TABLE `backpacks` ADD COLUMN `lastupdate` DATE DEFAULT '2020-04-20';");
|
||||
}
|
||||
catch(SQLException ignored) {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user