Revert "add flyway migrations - older flyway as new one is being a dick"

This reverts commit efc2707a
This commit is contained in:
Dom Bridge 2023-01-13 23:13:31 +00:00
parent 11fd7d8c26
commit ca5970b2b7
5 changed files with 74 additions and 31738 deletions

12
pom.xml
View File

@ -175,12 +175,6 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>7.7.3</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
@ -223,11 +217,5 @@
<scope>test</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.flywaydb</groupId>-->
<!-- <artifactId>flyway-mysql</artifactId>-->
<!-- <version>9.11.0</version>-->
<!-- </dependency>-->
</dependencies>
</project>

View File

@ -3,8 +3,6 @@ package com.eu.habbo;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.ConsoleAppender;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;
import com.eu.habbo.core.*;
import com.eu.habbo.core.consolecommands.ConsoleCommand;
import com.eu.habbo.database.Database;
@ -19,8 +17,6 @@ import com.eu.habbo.plugin.events.emulator.EmulatorStartShutdownEvent;
import com.eu.habbo.plugin.events.emulator.EmulatorStoppedEvent;
import com.eu.habbo.threading.ThreadPooling;
import com.eu.habbo.util.imager.badges.BadgeImager;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -62,43 +58,33 @@ public final class Emulator {
""";
@Getter
private static int timeStarted = 0;
@Getter
private static Runtime runtime;
@Getter
private static ConfigurationManager config;
@Getter
private static CryptoConfig crypto;
@Getter
private static TextsManager texts;
@Getter
private static GameServer gameServer;
@Getter
private static RCONServer rconServer;
@Setter
@Getter
private static CameraClient cameraClient;
@Getter
private static Database database;
@Getter
private static DatabaseLogger databaseLogger;
@Getter
private static ThreadPooling threading;
@Getter
private static GameEnvironment gameEnvironment;
@Getter
private static PluginManager pluginManager;
@Getter
private static BadgeImager badgeImager;
static {
Thread hook = new Thread(Emulator::dispose);
Thread hook = new Thread(new Runnable() {
public synchronized void run() {
Emulator.dispose();
}
});
hook.setPriority(10);
Runtime.getRuntime().addShutdownHook(hook);
}
public static void promptEnterKey() {
public static void promptEnterKey(){
log.info("\n");
log.info("This is a developer preview build. Your plugins for Arcturus Morningstar 3.x will NOT work on this build.");
log.info("Press \"ENTER\" if you agree to the terms stated above...");
@ -119,7 +105,7 @@ public final class Emulator {
appender.start();
}
Locale.setDefault( Locale.ENGLISH);
Locale.setDefault(new Locale("en"));
setBuild();
Emulator.stopped = false;
ConsoleCommand.load();
@ -127,7 +113,7 @@ public final class Emulator {
System.out.println(logo);
// Checks if this is a BETA build before allowing them to continue.
if (PREVIEW.toLowerCase().contains("preview")) {
if (PREVIEW.toLowerCase().contains("preview") ) {
System.out.println();
promptEnterKey();
}
@ -229,7 +215,7 @@ public final class Emulator {
try {
String filepath = new File(Emulator.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath();
MessageDigest md = MessageDigest.getInstance("MD5");// MD5
try (FileInputStream fis = new FileInputStream(filepath)) {
try(FileInputStream fis = new FileInputStream(filepath)) {
byte[] dataBytes = new byte[1024];
int nread;
while ((nread = fis.read(dataBytes)) != -1)
@ -316,11 +302,71 @@ public final class Emulator {
}
}
public static ConfigurationManager getConfig() {
return config;
}
public static CryptoConfig getCrypto() {
return crypto;
}
public static TextsManager getTexts() {
return texts;
}
public static Database getDatabase() {
return database;
}
public static DatabaseLogger getDatabaseLogger() {
return databaseLogger;
}
public static Runtime getRuntime() {
return runtime;
}
public static GameServer getGameServer() {
return gameServer;
}
public static RCONServer getRconServer() {
return rconServer;
}
public static ThreadPooling getThreading() {
return threading;
}
public static GameEnvironment getGameEnvironment() {
return gameEnvironment;
}
public static PluginManager getPluginManager() {
return pluginManager;
}
public static Random getRandom() {
return ThreadLocalRandom.current();
}
public static BadgeImager getBadgeImager() {
return badgeImager;
}
public static synchronized CameraClient getCameraClient() {
return cameraClient;
}
public static synchronized void setCameraClient(CameraClient client) {
cameraClient = client;
}
public static int getTimeStarted() {
return timeStarted;
}
public static int getOnlineTime() {
return getIntUnixTimestamp() - timeStarted;
}
@ -333,7 +379,7 @@ public final class Emulator {
int totalSeconds = 0;
Matcher m = Pattern.compile("(([0-9]*) (second|minute|hour|day|week|month|year))").matcher(timeString);
Map<String, Integer> map = new HashMap<>();
Map<String,Integer> map = new HashMap<>();
map.put("second", 1);
map.put("minute", 60);
map.put("hour", 3600);
@ -347,8 +393,8 @@ public final class Emulator {
int amount = Integer.parseInt(m.group(2));
String what = m.group(3);
totalSeconds += amount * map.get(what);
} catch (Exception ignored) {
}
catch (Exception ignored) { }
}
return totalSeconds;
@ -374,8 +420,8 @@ public final class Emulator {
int amount = Integer.parseInt(m.group(2));
String what = m.group(3);
c.add(map.get(what), amount);
} catch (Exception ignored) {
}
catch (Exception ignored) { }
}
return c.getTime();
@ -384,7 +430,7 @@ public final class Emulator {
private static String dateToUnixTimestamp(Date date) {
String res = "";
Date aux = stringToDate("1970-01-01 00:00:00");
if (aux == null) return null;
if(aux == null) return null;
Timestamp aux1 = dateToTimeStamp(aux);
Timestamp aux2 = dateToTimeStamp(date);

View File

@ -6,8 +6,6 @@ import com.zaxxer.hikari.HikariDataSource;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
import lombok.extern.slf4j.Slf4j;
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.output.MigrateResult;
import java.sql.Connection;
import java.sql.PreparedStatement;
@ -44,20 +42,6 @@ public class Database {
}
log.info("Database -> Connected! ({} MS)", System.currentTimeMillis() - millis);
Flyway flyway = Flyway.configure().placeholderReplacement(false).dataSource(dataSource).load();
MigrateResult migrateResult = flyway.migrate();
if (migrateResult.migrationsExecuted > 0) {
if (migrateResult.initialSchemaVersion != null)
log.info("Database -> {} Original Schema Version", migrateResult.initialSchemaVersion);
else
log.info("Database -> Initial migration completed");
log.info("Database -> Successfully migrated! ({} migrations executed)", migrateResult.migrationsExecuted);
}
log.info("Database -> Ready!");
}
public void dispose() {

File diff suppressed because one or more lines are too long

View File

@ -62,10 +62,6 @@
<level value="error"/>
</logger>
<logger name="org.flywaydb.core.internal.sqlscript">
<level value="warn"/>
</logger>
<root level="info">
<appender-ref ref="Console" />
<appender-ref ref="FileDebug" />