add guild databasing and caching + guild creation and information cmds

This commit is contained in:
Taah
2022-05-05 19:28:39 -07:00
parent 21ddd9d361
commit 2398d44074
16 changed files with 545 additions and 66 deletions

View File

@ -0,0 +1,39 @@
package dev.plex.data;
import dev.plex.Plex;
import dev.plex.storage.StorageType;
import java.sql.Connection;
import java.sql.SQLException;
public class SQLManager
{
public static void makeTables()
{
if (Plex.get().getStorageType() == StorageType.MONGODB)
{
return;
}
try (Connection connection = Plex.get().getSqlConnection().getCon())
{
connection.prepareStatement(
"CREATE TABLE IF NOT EXISTS `guilds` (" +
"`name` VARCHAR(2000) NOT NULL, " +
"`owner` VARCHAR(46) NOT NULL, " +
"`createdAt` BIGINT NOT NULL, " +
"`prefix` VARCHAR(2000), " +
"`motd` VARCHAR(3000), " +
"`home` VARCHAR(1000)," +
"`members` LONGTEXT, " +
"`moderators` LONGTEXT, " +
"`tagEnabled` BOOLEAN" +
");"
).execute();
} catch (SQLException e)
{
e.printStackTrace();
}
}
}