From 0ccf90b139ac70b69145a3e2d9dd763a7c8379fa Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 9 Feb 2015 16:18:20 +1300 Subject: Start creating database schema --- src/org/traccar/database/DataManager.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/org') 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(); + } + } + } -- cgit v1.2.3