aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-05 16:49:40 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-05 16:49:40 +1200
commitc137c1056890b0590d15239a06493275e88c405d (patch)
treeb9db53885f79f74028a7d02e7638ea9efd866e7c /src/org
parent657420334287de87ed55f9f4c54ce1db6ee7a66b (diff)
downloadtrackermap-server-c137c1056890b0590d15239a06493275e88c405d.tar.gz
trackermap-server-c137c1056890b0590d15239a06493275e88c405d.tar.bz2
trackermap-server-c137c1056890b0590d15239a06493275e88c405d.zip
Move schema query to config
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/database/DataManager.java78
1 files changed, 1 insertions, 77 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index d1c10ec87..8ca89d558 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -156,83 +156,7 @@ public class DataManager {
return;
}
- QueryBuilder.create(dataSource,
- "CREATE TABLE user (" +
- "id INT PRIMARY KEY AUTO_INCREMENT," +
- "name VARCHAR(1024) NOT NULL," +
- "email VARCHAR(1024) NOT NULL UNIQUE," +
- "password VARCHAR(1024) NOT NULL," +
- "salt VARCHAR(1024) NOT NULL," +
- "readonly BOOLEAN DEFAULT false NOT NULL," +
- "admin BOOLEAN DEFAULT false NOT NULL," +
- "map VARCHAR(1024) DEFAULT 'osm' NOT NULL," +
- "language VARCHAR(1024) DEFAULT 'en' NOT NULL," +
- "distanceUnit VARCHAR(1024) DEFAULT 'km' NOT NULL," +
- "speedUnit VARCHAR(1024) DEFAULT 'kmh' NOT NULL," +
- "latitude DOUBLE DEFAULT 0 NOT NULL," +
- "longitude DOUBLE DEFAULT 0 NOT NULL," +
- "zoom INT DEFAULT 0 NOT NULL);" +
-
- "CREATE TABLE device (" +
- "id INT PRIMARY KEY AUTO_INCREMENT," +
- "name VARCHAR(1024) NOT NULL," +
- "uniqueId VARCHAR(1024) NOT NULL UNIQUE," +
- "status VARCHAR(1024)," +
- "lastUpdate TIMESTAMP," +
- "positionId INT," +
- "dataId INT);" +
-
- "CREATE TABLE user_device (" +
- "userId INT NOT NULL," +
- "deviceId INT NOT NULL," +
- "read BOOLEAN DEFAULT true NOT NULL," +
- "write BOOLEAN DEFAULT true NOT NULL," +
- "FOREIGN KEY (userId) REFERENCES user(id) ON DELETE CASCADE," +
- "FOREIGN KEY (deviceId) REFERENCES device(id) ON DELETE CASCADE);" +
-
- "CREATE INDEX user_device_user_id ON user_device(userId);" +
-
- "CREATE TABLE position (" +
- "id INT PRIMARY KEY AUTO_INCREMENT," +
- "protocol VARCHAR(1024)," +
- "deviceId INT NOT NULL," +
- "serverTime TIMESTAMP NOT NULL," +
- "deviceTime TIMESTAMP NOT NULL," +
- "fixTime TIMESTAMP NOT NULL," +
- "valid BOOLEAN NOT NULL," +
- "latitude DOUBLE NOT NULL," +
- "longitude DOUBLE NOT NULL," +
- "altitude DOUBLE NOT NULL," +
- "speed DOUBLE NOT NULL," +
- "course DOUBLE NOT NULL," +
- "address VARCHAR(1024)," +
- "other VARCHAR(8192) NOT NULL," +
- "FOREIGN KEY (deviceId) REFERENCES device(id) ON DELETE CASCADE);" +
-
- "CREATE TABLE data (" +
- "id INT PRIMARY KEY AUTO_INCREMENT," +
- "protocol VARCHAR(1024)," +
- "deviceId INT NOT NULL," +
- "serverTime TIMESTAMP NOT NULL," +
- "deviceTime TIMESTAMP NOT NULL," +
- "other VARCHAR(8192) NOT NULL," +
- "FOREIGN KEY (deviceId) REFERENCES device(id));" +
-
- "ALTER TABLE device ADD " +
- "FOREIGN KEY (positionId) REFERENCES position(id);" +
-
- "ALTER TABLE device ADD " +
- "FOREIGN KEY (dataId) REFERENCES data(id);" +
-
- "CREATE TABLE server (" +
- "id INT PRIMARY KEY AUTO_INCREMENT," +
- "registration BOOLEAN NOT NULL," +
- "latitude DOUBLE NOT NULL," +
- "longitude DOUBLE NOT NULL," +
- "zoom INT NOT NULL);" +
-
- "CREATE TABLE traccar1 (" +
- "id INT PRIMARY KEY AUTO_INCREMENT);").executeUpdate();
+ QueryBuilder.create(dataSource, properties.getProperty("database.createSchema")).executeUpdate();
User admin = new User();
admin.setName("admin");