update flyway

This commit is contained in:
Jason Penilla authored and Jason committed 2023-08-19 11:05:28 -07:00
1 parent 470e506cb0
commit dc9d9b06ef
8 files changed
+26 -13

No files matched your search

@@ -97,6 +97,9 @@ abstract class WriteDependencies : DefaultTask() {
private fun MutableSet<ResolvedDependencyResult>.addFrom(dependencies: Set<DependencyResult>) { private fun MutableSet<ResolvedDependencyResult>.addFrom(dependencies: Set<DependencyResult>) {
for (dependency in dependencies) { for (dependency in dependencies) {
dependency as ResolvedDependencyResult dependency as ResolvedDependencyResult
if (dependency.resolvedVariant.attributes.toString().contains("org.gradle.category=platform")) {
continue
}
add(dependency) add(dependency)
if (transitive.get()) { if (transitive.get()) {
addFrom(dependency.selected.dependencies) addFrom(dependency.selected.dependencies)
@@ -32,6 +32,12 @@ dependencies {
runtimeDownload(libs.assistedInject) { runtimeDownload(libs.assistedInject) {
isTransitive = false isTransitive = false
} }
runtimeDownload(libs.flyway) {
exclude("com.google", "gson")
}
runtimeDownload(libs.flywayMysql) {
isTransitive = false
}
} }
tasks { tasks {
+2 -1
View File
@@ -59,6 +59,8 @@ fun Task.standardRuntimeRelocations() {
relocateDependency("org.mariadb.jdbc") relocateDependency("org.mariadb.jdbc")
relocateDependency("org.postgresql") relocateDependency("org.postgresql")
relocateDependency("redis.clients.jedis") relocateDependency("redis.clients.jedis")
relocateDependency("org.flywaydb")
relocateDependency("com.fasterxml")
} }
/** /**
@@ -77,7 +79,6 @@ fun Task.standardRelocations() {
relocateDependency("ninja.egg82.messenger") relocateDependency("ninja.egg82.messenger")
relocateDependency("org.antlr") relocateDependency("org.antlr")
relocateDependency("com.electronwill") relocateDependency("com.electronwill")
relocateDependency("org.flywaydb")
} }
fun Task.relocateCloud() { fun Task.relocateCloud() {
+6 -2
View File
@@ -36,8 +36,12 @@ dependencies {
compileOnlyApi(libs.jdbiObject) compileOnlyApi(libs.jdbiObject)
compileOnlyApi(libs.jdbiPostgres) compileOnlyApi(libs.jdbiPostgres)
api(libs.hikariCP) api(libs.hikariCP)
api(libs.flyway) compileOnlyApi(libs.flyway) {
api(libs.flywayMysql) exclude("com.google", "gson")
}
compileOnlyApi(libs.flywayMysql) {
isTransitive = false
}
// Messaging // Messaging
api(libs.messenger) api(libs.messenger)
@@ -49,8 +49,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier; import org.checkerframework.framework.qual.DefaultQualifier;
import org.flywaydb.core.Flyway; import org.flywaydb.core.Flyway;
import org.flywaydb.core.internal.database.postgresql.PostgreSQLDatabaseType;
import org.flywaydb.core.internal.plugin.PluginRegister;
import org.jdbi.v3.core.Jdbi; import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.postgres.PostgresPlugin; import org.jdbi.v3.postgres.PostgresPlugin;
import org.jdbi.v3.sqlobject.SqlObjectPlugin; import org.jdbi.v3.sqlobject.SqlObjectPlugin;
@@ -143,7 +141,6 @@ public final class PostgreSQLUserManager extends DatabaseUserManager {
public PostgreSQLUserManager create() { public PostgreSQLUserManager create() {
SQLDrivers.loadFrom(this.getClass().getClassLoader()); SQLDrivers.loadFrom(this.getClass().getClassLoader());
PluginRegister.REGISTERED_PLUGINS.add(new PostgreSQLDatabaseType());
final HikariConfig hikariConfig = new HikariConfig(); final HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setMaximumPoolSize(20); hikariConfig.setMaximumPoolSize(20);
@@ -154,15 +151,17 @@ public final class PostgreSQLUserManager extends DatabaseUserManager {
final DataSource dataSource = new HikariDataSource(hikariConfig); final DataSource dataSource = new HikariDataSource(hikariConfig);
Flyway.configure(CarbonChat.class.getClassLoader()) final Flyway flyway = Flyway.configure(CarbonChat.class.getClassLoader())
.baselineVersion("0") .baselineVersion("0")
.baselineOnMigrate(true) .baselineOnMigrate(true)
.locations("queries/migrations/postgresql") .locations("queries/migrations/postgresql")
.dataSource(dataSource) .dataSource(dataSource)
.validateMigrationNaming(true) .validateMigrationNaming(true)
.validateOnMigrate(true) .validateOnMigrate(true)
.load() .load();
.migrate();
flyway.repair();
flyway.migrate();
final Jdbi jdbi = Jdbi.create(dataSource) final Jdbi jdbi = Jdbi.create(dataSource)
.registerArgument(new ComponentArgumentFactory()) .registerArgument(new ComponentArgumentFactory())
@@ -1,4 +1,4 @@
CREATE TABLE IF NOT EXISTS carbon_users ( CREATE TABLE carbon_users (
id uuid NOT NULL PRIMARY KEY, id uuid NOT NULL PRIMARY KEY,
muted BOOLEAN, muted BOOLEAN,
deafened BOOLEAN, deafened BOOLEAN,
@@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS carbon_users (
spying BOOLEAN spying BOOLEAN
); );
CREATE TABLE IF NOT EXISTS carbon_ignores ( CREATE TABLE carbon_ignores (
id uuid NOT NULL, id uuid NOT NULL,
ignoredplayer uuid NOT NULL, ignoredplayer uuid NOT NULL,
PRIMARY KEY (id, ignoredplayer) PRIMARY KEY (id, ignoredplayer)
@@ -1,4 +1,4 @@
CREATE TABLE IF NOT EXISTS carbon_leftchannels ( CREATE TABLE carbon_leftchannels (
id uuid NOT NULL, id uuid NOT NULL,
channel VARCHAR(100) NOT NULL, channel VARCHAR(100) NOT NULL,
PRIMARY KEY (id, channel) PRIMARY KEY (id, channel)
+1 -1
View File
@@ -46,7 +46,7 @@ versions:
hikari: 5.0.1 hikari: 5.0.1
mysql: 8.0.33 mysql: 8.0.33
protobuf: 3.21.9 protobuf: 3.21.9
flyway: 8.5.13 # DO NOT UPDATE. Something will break. flyway: 9.21.1
caffeine: 3.1.7 caffeine: 3.1.7
mariadb: 3.0.8 mariadb: 3.0.8
messenger: 1.0.0-SNAPSHOT messenger: 1.0.0-SNAPSHOT