Create users table for enterprise panel

This commit is contained in:
gravitylow committed 2014-01-22 16:05:44 -05:00
1 parent d49bb9c22e
commit 9e24ee6d12
1 file changed
+10
@@ -33,10 +33,12 @@ import java.sql.SQLException;
public class Database {
private static final String EVENTS_TABLE = "logs";
private static final String USERS_TABLE = "users";
private String sqlLogEvent;
private String sqlCleanEvents;
private String sqlCreateEvents;
private String sqlCreateUsers;
public enum DatabaseType {
MySQL,
@@ -94,6 +96,13 @@ public class Database {
" `user` VARCHAR(45) NOT NULL," +
" `check_type` VARCHAR(45) NOT NULL," +
" PRIMARY KEY (`id`));";
sqlCreateUsers = "CREATE TABLE IF NOT EXISTS " + prefix + USERS_TABLE + "(" +
" `id` INT NOT NULL AUTO_INCREMENT," +
" `username` VARCHAR(45) NOT NULL," +
" `password` VARCHAR(256) NOT NULL," +
" `privileges` VARCHAR(45) NOT NULL DEFAULT 'admin'," +
" PRIMARY KEY (`id`));";
}
public DatabaseType getType() {
@@ -132,6 +141,7 @@ public class Database {
eventBatch = connection.prepareStatement(sqlLogEvent);
connection.prepareStatement(sqlCreateEvents).executeUpdate();
connection.prepareStatement(sqlCreateUsers).executeUpdate();
connection.setAutoCommit(false);