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

@@ -49,8 +49,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
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.postgres.PostgresPlugin;
import org.jdbi.v3.sqlobject.SqlObjectPlugin;
@@ -143,7 +141,6 @@ public final class PostgreSQLUserManager extends DatabaseUserManager {
public PostgreSQLUserManager create() {
SQLDrivers.loadFrom(this.getClass().getClassLoader());
PluginRegister.REGISTERED_PLUGINS.add(new PostgreSQLDatabaseType());
final HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setMaximumPoolSize(20);
@@ -154,15 +151,17 @@ public final class PostgreSQLUserManager extends DatabaseUserManager {
final DataSource dataSource = new HikariDataSource(hikariConfig);
Flyway.configure(CarbonChat.class.getClassLoader())
final Flyway flyway = Flyway.configure(CarbonChat.class.getClassLoader())
.baselineVersion("0")
.baselineOnMigrate(true)
.locations("queries/migrations/postgresql")
.dataSource(dataSource)
.validateMigrationNaming(true)
.validateOnMigrate(true)
.load()
.migrate();
.load();
flyway.repair();
flyway.migrate();
final Jdbi jdbi = Jdbi.create(dataSource)
.registerArgument(new ComponentArgumentFactory())
@@ -1,4 +1,4 @@
CREATE TABLE IF NOT EXISTS carbon_users (
CREATE TABLE carbon_users (
id uuid NOT NULL PRIMARY KEY,
muted BOOLEAN,
deafened BOOLEAN,
@@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS carbon_users (
spying BOOLEAN
);
CREATE TABLE IF NOT EXISTS carbon_ignores (
CREATE TABLE carbon_ignores (
id uuid NOT NULL,
ignoredplayer uuid NOT NULL,
PRIMARY KEY (id, ignoredplayer)
@@ -1,4 +1,4 @@
CREATE TABLE IF NOT EXISTS carbon_leftchannels (
CREATE TABLE carbon_leftchannels (
id uuid NOT NULL,
channel VARCHAR(100) NOT NULL,
PRIMARY KEY (id, channel)