mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
MySQL fixes, relocations, minor touchups
This commit is contained in:
1 parent
988a5da77c
commit
f8e8be9979
6 files changed
+30
-13
No files matched your search
@@ -24,13 +24,22 @@ fun ShadowJar.standardRelocations() {
|
||||
relocateDependency("com.typesafe.config")
|
||||
relocateDependency("com.google.common")
|
||||
relocateDependency("com.google.thirdparty.publicsuffix")
|
||||
relocateDependency("com.google.protobuf")
|
||||
relocateDependency("it.unimi.dsi.fastutil")
|
||||
relocateDependency("org.jdbi")
|
||||
relocateDependency("com.github.benmanes")
|
||||
relocateDependency("org.mariadb.jdbc")
|
||||
relocateDependency("org.flywaydb.core")
|
||||
relocateDependency("com.mysql")
|
||||
//relocateDependency("org.flywaydb")
|
||||
relocateDependency("com.zaxxer.hikari")
|
||||
relocateDependency("org.postgresql")
|
||||
relocateDependency("redis.clients.jedis")
|
||||
//relocateDependency("org.slf4j")
|
||||
//relocateDependency("org.apache")
|
||||
relocateDependency("ninja.egg82.messenger")
|
||||
relocateDependency("org.antlr")
|
||||
relocateDependency("com.github.luben")
|
||||
relocateDependency("io.netty")
|
||||
}
|
||||
|
||||
fun ShadowJar.relocateCloud() {
|
||||
|
||||
@@ -42,6 +42,7 @@ import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.channels.ChannelRegistry;
|
||||
import net.draycia.carbon.api.channels.ChatChannel;
|
||||
import net.draycia.carbon.api.events.CarbonChatEvent;
|
||||
@@ -163,7 +164,7 @@ public class CarbonChannelRegistry implements ChannelRegistry, DefaultedRegistry
|
||||
|
||||
if (startVersion != endVersion) { // we might not have made any changes
|
||||
// TODO: use logger
|
||||
System.out.println("Updated config schema from " + startVersion + " to " + endVersion);
|
||||
CarbonChatProvider.carbonChat().logger().info("Updated config schema from " + startVersion + " to " + endVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,13 +28,18 @@ import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
@ConfigSerializable
|
||||
public class DatabaseSettings {
|
||||
|
||||
@Comment("JDBC URL")
|
||||
@Comment("""
|
||||
JDBC URL. Suggested defaults for each DB:
|
||||
MySQL: jdbc:mysql://host:3306/DB
|
||||
MariaDB: jdbc:mariadb://host:3306/DB
|
||||
PostgreSQL: jdbc:postgresql://host:5432/database
|
||||
""")
|
||||
private String url = "jdbc:mysql://localhost:3306/carbon";
|
||||
|
||||
@Comment("")
|
||||
@Comment("The connection username.")
|
||||
private String username = "username";
|
||||
|
||||
@Comment("")
|
||||
@Comment("The connection password.")
|
||||
private String password = "password";
|
||||
|
||||
public String url() {
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.sql.DataSource;
|
||||
import net.draycia.carbon.api.CarbonChat;
|
||||
import net.draycia.carbon.api.CarbonChatProvider;
|
||||
import net.draycia.carbon.api.users.ComponentPlayerResult;
|
||||
import net.draycia.carbon.api.users.UserManager;
|
||||
@@ -73,7 +72,7 @@ public final class MySQLUserManager implements UserManager<CarbonPlayerCommon>,
|
||||
try {
|
||||
//Class.forName("org.postgresql.Driver");
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
Class.forName("com.mysql.cj.jdbc.Driver"); // Manually loading this might not be necessary
|
||||
} catch (final Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
@@ -86,14 +85,16 @@ public final class MySQLUserManager implements UserManager<CarbonPlayerCommon>,
|
||||
|
||||
final DataSource dataSource = new HikariDataSource(hikariConfig);
|
||||
|
||||
Flyway.configure(CarbonChat.class.getClassLoader())
|
||||
final Flyway flyway = Flyway.configure(Thread.currentThread().getContextClassLoader())
|
||||
.baselineVersion("0")
|
||||
.baselineOnMigrate(true)
|
||||
.locations("queries/migrations/mysql")
|
||||
.dataSource(dataSource)
|
||||
.validateOnMigrate(true)
|
||||
.load()
|
||||
.migrate();
|
||||
.load();
|
||||
|
||||
flyway.repair();
|
||||
flyway.migrate();
|
||||
|
||||
final Jdbi jdbi = Jdbi.create(dataSource)
|
||||
.registerArrayType(UUID.class, "uuid")
|
||||
|
||||
@@ -40,9 +40,9 @@ versions:
|
||||
jdbi: 3.25.0
|
||||
hikari: 5.0.0
|
||||
mysql: 8.0.12
|
||||
flyway: 8.3.0
|
||||
flyway: 8.5.12
|
||||
caffeine: 3.0.5
|
||||
mariadb: 3.0.2-rc
|
||||
mariadb: 3.0.5
|
||||
messenger: 1.0.0-parks-SNAPSHOT
|
||||
netty: 4.1.68.Final
|
||||
zstdjni: 1.5.1-1
|
||||
|
||||
+2
-1
@@ -47,6 +47,7 @@ dependencyResolutionManagement {
|
||||
// DiscordSRV
|
||||
maven("https://m2.dv8tion.net/releases")
|
||||
maven("https://nexus.scarsz.me/content/groups/public/")
|
||||
mavenLocal()
|
||||
}
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
}
|
||||
@@ -73,7 +74,7 @@ sequenceOf(
|
||||
"api",
|
||||
"common",
|
||||
"paper",
|
||||
"sponge",
|
||||
//"sponge",
|
||||
"fabric",
|
||||
"velocity"
|
||||
).forEach {
|
||||
|
||||
Reference in new issue
Block a user