diff --git a/src/main/java/ca/tweetzy/skulls/database/migrations/_1_InitialMigration.java b/src/main/java/ca/tweetzy/skulls/database/migrations/_1_InitialMigration.java index 19d6a98..9d14de9 100644 --- a/src/main/java/ca/tweetzy/skulls/database/migrations/_1_InitialMigration.java +++ b/src/main/java/ca/tweetzy/skulls/database/migrations/_1_InitialMigration.java @@ -42,18 +42,18 @@ public void migrate(Connection connection, String tablePrefix) throws SQLExcepti try (Statement statement = connection.createStatement()) { - statement.execute("CREATE TABLE " + tablePrefix + "players (" + + statement.execute("CREATE TABLE IF NOT EXISTS " + tablePrefix + "players (" + "uuid VARCHAR(36) PRIMARY KEY, " + "favourites TEXT" + ")"); - statement.execute("CREATE TABLE " + tablePrefix + "categories (" + + statement.execute("CREATE TABLE IF NOT EXISTS " + tablePrefix + "categories (" + "id VARCHAR(64) PRIMARY KEY, " + "name VARCHAR(72) NOT NULL, " + "skulls TEXT NULL" + ")"); - statement.execute("CREATE TABLE " + tablePrefix + "skull (" + + statement.execute("CREATE TABLE IF NOT EXISTS " + tablePrefix + "skull (" + "id INTEGER PRIMARY KEY, " + "name VARCHAR(64) NOT NULL, " + "category VARCHAR(16) NOT NULL, " + diff --git a/src/main/java/ca/tweetzy/skulls/database/migrations/_2_PlacedSkullsMigration.java b/src/main/java/ca/tweetzy/skulls/database/migrations/_2_PlacedSkullsMigration.java index a7cdc47..3473567 100644 --- a/src/main/java/ca/tweetzy/skulls/database/migrations/_2_PlacedSkullsMigration.java +++ b/src/main/java/ca/tweetzy/skulls/database/migrations/_2_PlacedSkullsMigration.java @@ -41,7 +41,7 @@ public _2_PlacedSkullsMigration() { public void migrate(Connection connection, String tablePrefix) throws SQLException { try (Statement statement = connection.createStatement()) { - statement.execute("CREATE TABLE " + tablePrefix + "placed_skull (" + + statement.execute("CREATE TABLE IF NOT EXISTS " + tablePrefix + "placed_skull (" + "id VARCHAR(36) NOT NULL, " + "skull_id INTEGER NOT NULL," + "location VARCHAR(128) NOT NULL" + diff --git a/src/main/java/ca/tweetzy/skulls/database/migrations/_3_HistoryRemovalMigration.java b/src/main/java/ca/tweetzy/skulls/database/migrations/_3_HistoryRemovalMigration.java index 51ad2bf..0c54cb8 100644 --- a/src/main/java/ca/tweetzy/skulls/database/migrations/_3_HistoryRemovalMigration.java +++ b/src/main/java/ca/tweetzy/skulls/database/migrations/_3_HistoryRemovalMigration.java @@ -41,7 +41,7 @@ public _3_HistoryRemovalMigration() { public void migrate(Connection connection, String tablePrefix) throws SQLException { try (Statement statement = connection.createStatement()) { - statement.execute("DROP TABLE " + tablePrefix + "history"); + statement.execute("DROP TABLE IF EXISTS " + tablePrefix + "history"); } } }