From ca58c55eca97934f729436b779904ed51daed12a Mon Sep 17 00:00:00 2001 From: games647 Date: Fri, 8 Sep 2017 11:33:14 +0200 Subject: [PATCH] Remove legacy database migration code --- .../games647/fastlogin/core/AuthStorage.java | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java index db95fbc7..624ea4dc 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java @@ -15,8 +15,6 @@ import java.util.UUID; import java.util.concurrent.ThreadFactory; import java.util.logging.Level; -import javax.sql.DataSource; - public class AuthStorage { private static final String PREMIUM_TABLE = "premium"; @@ -63,10 +61,6 @@ public class AuthStorage { this.dataSource = new HikariDataSource(config); } - public DataSource getDataSource() { - return dataSource; - } - public void createTables() throws SQLException { Connection con = null; Statement createStmt = null; @@ -90,34 +84,6 @@ public class AuthStorage { } createStmt.executeUpdate(createDataStmt); - - //drop the old unique uuid index - try { - if (dataSource.getJdbcUrl().contains("sqlite")) { - String tempTableCreate = createDataStmt.replace(PREMIUM_TABLE, PREMIUM_TABLE + "_TEMP") - //if we already imported the table fail here - .replace("IF NOT EXISTS", ""); - //create a temp table insert it there and then back - createStmt.executeUpdate(tempTableCreate); - createStmt.executeUpdate("INSERT INTO " + PREMIUM_TABLE + "_TEMP SELECT * FROM " + PREMIUM_TABLE); - - createStmt.executeUpdate("DROP TABLE " + PREMIUM_TABLE); - createStmt.executeUpdate(createDataStmt); - - //insert it back into the new table - createStmt.executeUpdate("INSERT INTO " + PREMIUM_TABLE + " SELECT * FROM " + PREMIUM_TABLE + "_TEMP"); - } else { - createStmt.executeUpdate("ALTER TABLE premium DROP INDEX UUID"); - } - } catch (SQLException sqlEx) { - //silent - we already migrated - } - - try { - createStmt.executeUpdate("CREATE INDEX uuid_idx on premium (UUID)"); - } catch (SQLException sqlEx) { - //silent - we already migrated - } } finally { closeQuietly(con); closeQuietly(createStmt);