diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-02-09 16:18:20 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-02-09 16:18:20 +1300 |
commit | 0ccf90b139ac70b69145a3e2d9dd763a7c8379fa (patch) | |
tree | 0e4de7e55b7a50ce39c7335e039d8db407a8e6c0 /src/org/traccar/database/DataManager.java | |
parent | 24071162ec7cbae1c8a06e1e51837e9e9b2e8bdb (diff) | |
download | traccar-server-0ccf90b139ac70b69145a3e2d9dd763a7c8379fa.tar.gz traccar-server-0ccf90b139ac70b69145a3e2d9dd763a7c8379fa.tar.bz2 traccar-server-0ccf90b139ac70b69145a3e2d9dd763a7c8379fa.zip |
Start creating database schema
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r-- | src/org/traccar/database/DataManager.java | 24 |
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(); + } + } + } |