diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/SqlDao.java b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/SqlDao.java index 2ebf83d6..9a4ed85e 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/SqlDao.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/SqlDao.java @@ -195,6 +195,13 @@ public class SqlDao extends AbstractDao { } } + // migrations + try (Connection connection = provider.getConnection()) { + try (Statement s = connection.createStatement()) { + s.execute(prefix.apply("ALTER TABLE {prefix}actions MODIFY COLUMN actor_name VARCHAR(36)")); + } + } + setAcceptingLogins(true); } catch (Exception e) { e.printStackTrace(); diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/FlatfileConnectionFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/FlatfileConnectionFactory.java index 1bc686d5..083b390b 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/FlatfileConnectionFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/FlatfileConnectionFactory.java @@ -35,7 +35,7 @@ import java.text.DecimalFormat; import java.util.concurrent.locks.ReentrantLock; abstract class FlatfileConnectionFactory extends AbstractConnectionFactory { - protected static final DecimalFormat DF = new DecimalFormat("#.00"); + protected static final DecimalFormat DF = new DecimalFormat("#.##"); protected final File file; private final ReentrantLock lock = new ReentrantLock(); diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/H2ConnectionFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/H2ConnectionFactory.java index e0eefb31..63b4c385 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/H2ConnectionFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/H2ConnectionFactory.java @@ -46,7 +46,7 @@ public class H2ConnectionFactory extends FlatfileConnectionFactory { File databaseFile = new File(super.file.getParent(), "luckperms-h2.mv.db"); if (databaseFile.exists()) { - double size = databaseFile.length() / 1048576; + double size = databaseFile.length() / 1048576D; ret.put("File Size", DF.format(size) + "MB"); } else { ret.put("File Size", "0MB"); diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/SQLiteConnectionFactory.java b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/SQLiteConnectionFactory.java index 24cb53e1..b0e2bd38 100644 --- a/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/SQLiteConnectionFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/storage/dao/sql/connection/file/SQLiteConnectionFactory.java @@ -46,7 +46,7 @@ public class SQLiteConnectionFactory extends FlatfileConnectionFactory { File databaseFile = new File(super.file.getParent(), "luckperms-sqlite.db"); if (databaseFile.exists()) { - double size = databaseFile.length() / 1048576; + double size = databaseFile.length() / 1048576D; ret.put("File Size", DF.format(size) + "MB"); } else { ret.put("File Size", "0MB"); diff --git a/common/src/main/resources/schema/h2.sql b/common/src/main/resources/schema/h2.sql index beef6994..5f102bb7 100644 --- a/common/src/main/resources/schema/h2.sql +++ b/common/src/main/resources/schema/h2.sql @@ -45,7 +45,7 @@ CREATE TABLE `{prefix}actions` ( `id` INT AUTO_INCREMENT NOT NULL, `time` BIGINT NOT NULL, `actor_uuid` VARCHAR(36) NOT NULL, - `actor_name` VARCHAR(16) NOT NULL, + `actor_name` VARCHAR(36) NOT NULL, `type` CHAR(1) NOT NULL, `acted_uuid` VARCHAR(36) NOT NULL, `acted_name` VARCHAR(36) NOT NULL, diff --git a/common/src/main/resources/schema/mariadb.sql b/common/src/main/resources/schema/mariadb.sql index 0d5088e9..9a75350e 100644 --- a/common/src/main/resources/schema/mariadb.sql +++ b/common/src/main/resources/schema/mariadb.sql @@ -45,7 +45,7 @@ CREATE TABLE `{prefix}actions` ( `id` INT AUTO_INCREMENT NOT NULL, `time` BIGINT NOT NULL, `actor_uuid` VARCHAR(36) NOT NULL, - `actor_name` VARCHAR(16) NOT NULL, + `actor_name` VARCHAR(36) NOT NULL, `type` CHAR(1) NOT NULL, `acted_uuid` VARCHAR(36) NOT NULL, `acted_name` VARCHAR(36) NOT NULL, diff --git a/common/src/main/resources/schema/mysql.sql b/common/src/main/resources/schema/mysql.sql index 99b8e364..88ebfffa 100644 --- a/common/src/main/resources/schema/mysql.sql +++ b/common/src/main/resources/schema/mysql.sql @@ -45,7 +45,7 @@ CREATE TABLE `{prefix}actions` ( `id` INT AUTO_INCREMENT NOT NULL, `time` BIGINT NOT NULL, `actor_uuid` VARCHAR(36) NOT NULL, - `actor_name` VARCHAR(16) NOT NULL, + `actor_name` VARCHAR(36) NOT NULL, `type` CHAR(1) NOT NULL, `acted_uuid` VARCHAR(36) NOT NULL, `acted_name` VARCHAR(36) NOT NULL, diff --git a/common/src/main/resources/schema/postgresql.sql b/common/src/main/resources/schema/postgresql.sql index c11bf569..16cedc1e 100644 --- a/common/src/main/resources/schema/postgresql.sql +++ b/common/src/main/resources/schema/postgresql.sql @@ -41,7 +41,7 @@ CREATE TABLE "{prefix}actions" ( "id" SERIAL PRIMARY KEY NOT NULL, "time" BIGINT NOT NULL, "actor_uuid" VARCHAR(36) NOT NULL, - "actor_name" VARCHAR(16) NOT NULL, + "actor_name" VARCHAR(36) NOT NULL, "type" CHAR(1) NOT NULL, "acted_uuid" VARCHAR(36) NOT NULL, "acted_name" VARCHAR(36) NOT NULL, diff --git a/common/src/main/resources/schema/sqlite.sql b/common/src/main/resources/schema/sqlite.sql index dec6bbc9..a13390bd 100644 --- a/common/src/main/resources/schema/sqlite.sql +++ b/common/src/main/resources/schema/sqlite.sql @@ -43,7 +43,7 @@ CREATE TABLE `{prefix}actions` ( `id` INTEGER PRIMARY KEY NOT NULL, `time` BIGINT NOT NULL, `actor_uuid` VARCHAR(36) NOT NULL, - `actor_name` VARCHAR(16) NOT NULL, + `actor_name` VARCHAR(36) NOT NULL, `type` CHAR(1) NOT NULL, `acted_uuid` VARCHAR(36) NOT NULL, `acted_name` VARCHAR(36) NOT NULL,