Fixes #353 on new databases and existing MySQL databases

This commit is contained in:
Rsl1122 2017-10-24 11:47:13 +03:00
parent e7fbee7991
commit 7790058bbe
2 changed files with 8 additions and 1 deletions

View File

@ -132,6 +132,7 @@ public abstract class SQLDB extends Database {
setVersion(11);
}
if (version < 12) {
actionsTable.alterTableV12();
ipsTable.alterTableV12();
setVersion(12);
}

View File

@ -68,12 +68,18 @@ public class ActionsTable extends UserIDTable {
.column(columnServerID, Sql.INT).notNull()
.column(columnDate, Sql.LONG).notNull()
.column(columnActionID, Sql.INT).notNull()
.column(columnAdditionalInfo, Sql.varchar(100))
.column(columnAdditionalInfo, Sql.varchar(300))
.foreignKey(columnUserID, usersTable.toString(), usersTable.getColumnID())
.foreignKey(columnServerID, serverTable.toString(), serverTable.getColumnID())
.toString());
}
public void alterTableV12() throws SQLException {
if (usingMySQL) {
executeUnsafe("ALTER TABLE " + tableName + " MODIFY " + columnAdditionalInfo + " VARCHAR(300)");
}
}
public void insertAction(UUID uuid, Action action) throws SQLException {
execute(new ExecStatement(insertStatement) {
@Override