aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/DataManager.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index fc83e53a3..336ac3e34 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -94,6 +94,8 @@ public class DataManager {
ds.setTestConnectionOnCheckin(true);
dataSource = ds;
+ //createDatabaseSchema();
+
// Load statements from configuration
String query;
@@ -215,4 +217,26 @@ public class DataManager {
return params;
}
+ private void createDatabaseSchema() throws SQLException {
+
+ Connection connection = dataSource.getConnection();
+ try {
+ Statement statement = connection.createStatement();
+ try {
+
+ statement.execute(
+ "CREATE TABLE users_new (" +
+ "id INT PRIMARY KEY AUTO_INCREMENT," +
+ "name VARCHAR(1024) NOT NULL UNIQUE," +
+ "password VARCHAR(1024) NOT NULL," +
+ "admin BOOLEAN NOT NULL)");
+
+ } finally {
+ statement.close();
+ }
+ } finally {
+ connection.close();
+ }
+ }
+
}