mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-17 08:05:35 +01:00
Delete temporary H2 v1 to v2 migration script if exists (#3693)
This commit is contained in:
parent
7297fb862c
commit
f788088a69
@ -34,15 +34,12 @@ import redis.clients.jedis.DefaultJedisClientConfig;
|
|||||||
import redis.clients.jedis.HostAndPort;
|
import redis.clients.jedis.HostAndPort;
|
||||||
import redis.clients.jedis.JedisClientConfig;
|
import redis.clients.jedis.JedisClientConfig;
|
||||||
import redis.clients.jedis.JedisCluster;
|
import redis.clients.jedis.JedisCluster;
|
||||||
import redis.clients.jedis.JedisPool;
|
|
||||||
import redis.clients.jedis.JedisPooled;
|
import redis.clients.jedis.JedisPooled;
|
||||||
import redis.clients.jedis.JedisPubSub;
|
import redis.clients.jedis.JedisPubSub;
|
||||||
import redis.clients.jedis.Protocol;
|
import redis.clients.jedis.Protocol;
|
||||||
import redis.clients.jedis.UnifiedJedis;
|
import redis.clients.jedis.UnifiedJedis;
|
||||||
import redis.clients.jedis.exceptions.JedisClusterOperationException;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -31,7 +31,12 @@ import net.kyori.adventure.text.Component;
|
|||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.luckperms.api.util.Tristate;
|
import net.luckperms.api.util.Tristate;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple implementation of {@link Sender} using a {@link SenderFactory}
|
* Simple implementation of {@link Sender} using a {@link SenderFactory}
|
||||||
|
@ -28,6 +28,7 @@ package me.lucko.luckperms.common.storage.implementation.sql.connection.file;
|
|||||||
import me.lucko.luckperms.common.dependencies.Dependency;
|
import me.lucko.luckperms.common.dependencies.Dependency;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@ -123,6 +124,12 @@ public class H2ConnectionFactory extends FlatfileConnectionFactory {
|
|||||||
|
|
||||||
this.plugin.getLogger().warn("[DB Upgrade] Found an old (v1) H2 database file. LuckPerms will now attempt to upgrade it to v2 (this is a one time operation).");
|
this.plugin.getLogger().warn("[DB Upgrade] Found an old (v1) H2 database file. LuckPerms will now attempt to upgrade it to v2 (this is a one time operation).");
|
||||||
|
|
||||||
|
try {
|
||||||
|
Files.deleteIfExists(tempMigrationFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
this.plugin.getLogger().warn("[DB Upgrade] Unable to delete temporary data from a previous migration attempt", e);
|
||||||
|
}
|
||||||
|
|
||||||
this.plugin.getLogger().info("[DB Upgrade] Stage 1: Exporting the old database to an intermediary file...");
|
this.plugin.getLogger().info("[DB Upgrade] Stage 1: Exporting the old database to an intermediary file...");
|
||||||
Constructor<?> constructor = getConnectionConstructor();
|
Constructor<?> constructor = getConnectionConstructor();
|
||||||
try (Connection c = getConnection(constructor, oldDatabase)) {
|
try (Connection c = getConnection(constructor, oldDatabase)) {
|
||||||
|
@ -28,9 +28,7 @@ package me.lucko.luckperms.common.storage.implementation.sql.connection.hikari;
|
|||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import me.lucko.luckperms.common.storage.misc.StorageCredentials;
|
import me.lucko.luckperms.common.storage.misc.StorageCredentials;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class MariaDbConnectionFactory extends HikariConnectionFactory {
|
public class MariaDbConnectionFactory extends HikariConnectionFactory {
|
||||||
public MariaDbConnectionFactory(StorageCredentials configuration) {
|
public MariaDbConnectionFactory(StorageCredentials configuration) {
|
||||||
|
@ -28,10 +28,6 @@ package me.lucko.luckperms.common.storage.implementation.sql.connection.hikari;
|
|||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import me.lucko.luckperms.common.storage.misc.StorageCredentials;
|
import me.lucko.luckperms.common.storage.misc.StorageCredentials;
|
||||||
|
|
||||||
import java.sql.Driver;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
@ -46,7 +46,9 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
public class CommandsIntegrationTest {
|
public class CommandsIntegrationTest {
|
||||||
|
|
||||||
|
@ -51,7 +51,9 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import static org.awaitility.Awaitility.await;
|
import static org.awaitility.Awaitility.await;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
|
||||||
public class ImportExportIntegrationTest {
|
public class ImportExportIntegrationTest {
|
||||||
|
|
||||||
|
@ -40,7 +40,9 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A set of 'integration tests' for the standalone LuckPerms app.
|
* A set of 'integration tests' for the standalone LuckPerms app.
|
||||||
|
@ -35,7 +35,13 @@ import net.luckperms.api.util.Tristate;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
Loading…
Reference in New Issue
Block a user