Make the standard MySQL driver the default again
This commit is contained in:
@@ -60,8 +60,8 @@ public class DependencyManager {
|
||||
.put(StorageType.JSON, ImmutableList.of())
|
||||
.put(StorageType.YAML, ImmutableList.of())
|
||||
.put(StorageType.MONGODB, ImmutableList.of(Dependency.MONGODB_DRIVER))
|
||||
.put(StorageType.MYSQL, ImmutableList.of(Dependency.MARIADB_DRIVER, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, Dependency.HIKARI))
|
||||
.put(StorageType.MYSQL_LEGACY, ImmutableList.of(Dependency.MYSQL_DRIVER, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, Dependency.HIKARI))
|
||||
.put(StorageType.MARIADB, ImmutableList.of(Dependency.MARIADB_DRIVER, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, Dependency.HIKARI))
|
||||
.put(StorageType.MYSQL, ImmutableList.of(Dependency.MYSQL_DRIVER, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, Dependency.HIKARI))
|
||||
.put(StorageType.POSTGRESQL, ImmutableList.of(Dependency.POSTGRESQL_DRIVER, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, Dependency.HIKARI))
|
||||
.put(StorageType.SQLITE, ImmutableList.of(Dependency.SQLITE_DRIVER))
|
||||
.put(StorageType.H2, ImmutableList.of(Dependency.H2_DRIVER))
|
||||
|
||||
@@ -122,16 +122,35 @@ public class StorageFactory {
|
||||
|
||||
private static AbstractBacking makeBacking(StorageType method, LuckPermsPlugin plugin) {
|
||||
switch (method) {
|
||||
case MARIADB:
|
||||
return new SQLBacking(plugin, new MySQLProvider(
|
||||
"MariaDB",
|
||||
"org.mariadb.jdbc.MySQLDataSource",
|
||||
plugin.getConfiguration().get(ConfigKeys.DATABASE_VALUES)),
|
||||
plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX)
|
||||
);
|
||||
case MYSQL:
|
||||
return new SQLBacking(plugin, new MySQLProvider("MySQL", "org.mariadb.jdbc.MySQLDataSource", plugin.getConfiguration().get(ConfigKeys.DATABASE_VALUES)), plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX));
|
||||
case MYSQL_LEGACY:
|
||||
return new SQLBacking(plugin, new MySQLProvider("MySQL-Legacy", "com.mysql.jdbc.jdbc2.optional.MysqlDataSource", plugin.getConfiguration().get(ConfigKeys.DATABASE_VALUES)), plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX));
|
||||
return new SQLBacking(plugin, new MySQLProvider(
|
||||
"MySQL",
|
||||
"com.mysql.jdbc.jdbc2.optional.MysqlDataSource",
|
||||
plugin.getConfiguration().get(ConfigKeys.DATABASE_VALUES)),
|
||||
plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX)
|
||||
);
|
||||
case SQLITE:
|
||||
return new SQLBacking(plugin, new SQLiteProvider(new File(plugin.getDataDirectory(), "luckperms-sqlite.db")), plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX));
|
||||
return new SQLBacking(plugin, new SQLiteProvider(
|
||||
new File(plugin.getDataDirectory(), "luckperms-sqlite.db")),
|
||||
plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX)
|
||||
);
|
||||
case H2:
|
||||
return new SQLBacking(plugin, new H2Provider(new File(plugin.getDataDirectory(), "luckperms-h2")), plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX));
|
||||
return new SQLBacking(plugin, new H2Provider(
|
||||
new File(plugin.getDataDirectory(), "luckperms-h2")),
|
||||
plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX)
|
||||
);
|
||||
case POSTGRESQL:
|
||||
return new SQLBacking(plugin, new PostgreSQLProvider(plugin.getConfiguration().get(ConfigKeys.DATABASE_VALUES)), plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX));
|
||||
return new SQLBacking(plugin, new PostgreSQLProvider(
|
||||
plugin.getConfiguration().get(ConfigKeys.DATABASE_VALUES)),
|
||||
plugin.getConfiguration().get(ConfigKeys.SQL_TABLE_PREFIX)
|
||||
);
|
||||
case MONGODB:
|
||||
return new MongoDBBacking(plugin, plugin.getConfiguration().get(ConfigKeys.DATABASE_VALUES));
|
||||
case YAML:
|
||||
|
||||
@@ -33,8 +33,8 @@ public enum StorageType {
|
||||
JSON("JSON", "json", "flatfile"),
|
||||
YAML("YAML", "yaml", "yml"),
|
||||
MONGODB("MongoDB", "mongodb"),
|
||||
MARIADB("MariaDB", "mariadb"),
|
||||
MYSQL("MySQL", "mysql"),
|
||||
MYSQL_LEGACY("MySQL-Legacy", "mysql-legacy"),
|
||||
POSTGRESQL("PostgreSQL", "postgresql"),
|
||||
SQLITE("SQLite", "sqlite"),
|
||||
H2("H2", "h2");
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class MySQLProvider extends SQLProvider {
|
||||
config.setUsername(username);
|
||||
config.setPassword(password);
|
||||
|
||||
if (getName().toLowerCase().endsWith("legacy")) {
|
||||
if (!getName().toLowerCase().equals("mariadb")) {
|
||||
|
||||
// doesn't exist on the MariaDB driver
|
||||
config.addDataSourceProperty("cachePrepStmts", "true");
|
||||
|
||||
@@ -43,7 +43,7 @@ public class HikariSupplier implements AutoCloseable {
|
||||
hikari = new HikariDataSource();
|
||||
hikari.setPoolName(poolName);
|
||||
hikari.setMaximumPoolSize(2);
|
||||
hikari.setDataSourceClassName("org.mariadb.jdbc.Driver");
|
||||
hikari.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
|
||||
hikari.addDataSourceProperty("serverName", address.split(":")[0]);
|
||||
hikari.addDataSourceProperty("port", address.split(":")[1]);
|
||||
hikari.addDataSourceProperty("databaseName", database);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
-- LuckPerms MariaDB Schema
|
||||
|
||||
CREATE TABLE `{prefix}user_permissions` (
|
||||
`id` INT AUTO_INCREMENT NOT NULL,
|
||||
`uuid` VARCHAR(36) NOT NULL,
|
||||
`permission` VARCHAR(200) NOT NULL,
|
||||
`value` BOOL NOT NULL,
|
||||
`server` VARCHAR(36) NOT NULL,
|
||||
`world` VARCHAR(36) NOT NULL,
|
||||
`expiry` INT(11) NOT NULL,
|
||||
`contexts` VARCHAR(200) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET = utf8;
|
||||
CREATE INDEX `{prefix}user_permissions_uuid` ON `{prefix}user_permissions` (`uuid`);
|
||||
CREATE INDEX `{prefix}user_permissions_permission` ON `{prefix}user_permissions` (`permission`);
|
||||
|
||||
CREATE TABLE `{prefix}group_permissions` (
|
||||
`id` INT AUTO_INCREMENT NOT NULL,
|
||||
`name` VARCHAR(36) NOT NULL,
|
||||
`permission` VARCHAR(200) NOT NULL,
|
||||
`value` BOOL NOT NULL,
|
||||
`server` VARCHAR(36) NOT NULL,
|
||||
`world` VARCHAR(36) NOT NULL,
|
||||
`expiry` INT(11) NOT NULL,
|
||||
`contexts` VARCHAR(200) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET = utf8;
|
||||
CREATE INDEX `{prefix}group_permissions_name` ON `{prefix}group_permissions` (`name`);
|
||||
CREATE INDEX `{prefix}group_permissions_permission` ON `{prefix}group_permissions` (`permission`);
|
||||
|
||||
CREATE TABLE `{prefix}players` (
|
||||
`uuid` VARCHAR(36) NOT NULL,
|
||||
`username` VARCHAR(16) NOT NULL,
|
||||
`primary_group` VARCHAR(36) NOT NULL,
|
||||
PRIMARY KEY (`uuid`)
|
||||
) DEFAULT CHARSET = utf8;
|
||||
CREATE INDEX `{prefix}players_username` ON `{prefix}players` (`username`);
|
||||
|
||||
CREATE TABLE `{prefix}groups` (
|
||||
`name` VARCHAR(36) NOT NULL,
|
||||
PRIMARY KEY (`name`)
|
||||
) DEFAULT CHARSET = utf8;
|
||||
|
||||
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,
|
||||
`type` CHAR(1) NOT NULL,
|
||||
`acted_uuid` VARCHAR(36) NOT NULL,
|
||||
`acted_name` VARCHAR(36) NOT NULL,
|
||||
`action` VARCHAR(256) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET = utf8;
|
||||
|
||||
CREATE TABLE `{prefix}tracks` (
|
||||
`name` VARCHAR(36) NOT NULL,
|
||||
`groups` TEXT NOT NULL,
|
||||
PRIMARY KEY (`name`)
|
||||
) DEFAULT CHARSET = utf8;
|
||||
Reference in New Issue
Block a user