Attempt to fix issue #2158
This commit is contained in:
@@ -184,9 +184,6 @@ public class SQLite extends AbstractSqlDataSource {
|
||||
if (isColumnMissing(md, col.TOTP_KEY)) {
|
||||
st.executeUpdate("ALTER TABLE " + tableName
|
||||
+ " ADD COLUMN " + col.TOTP_KEY + " VARCHAR(32);");
|
||||
} else if (isColumnSizeIncorrect(md, col.TOTP_KEY, 32)) {
|
||||
st.executeUpdate("ALTER TABLE " + tableName
|
||||
+ " ALTER COLUMN " + col.TOTP_KEY + " VARCHAR(32);");
|
||||
}
|
||||
|
||||
if (!col.PLAYER_UUID.isEmpty() && isColumnMissing(md, col.PLAYER_UUID)) {
|
||||
@@ -217,16 +214,6 @@ public class SQLite extends AbstractSqlDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isColumnSizeIncorrect(DatabaseMetaData metaData, String columnName, int size) throws SQLException {
|
||||
try (ResultSet rs = metaData.getColumns(null, null, tableName, columnName)) {
|
||||
if (!rs.next()) {
|
||||
throw new RuntimeException("Column " + columnName + " doesn't exist!");
|
||||
}
|
||||
int currentSize = rs.getInt("COLUMN_SIZE");
|
||||
return size != currentSize;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
close(con);
|
||||
|
||||
Reference in New Issue
Block a user