true 8082 web webm false nominatim http://nominatim.openstreetmap.org/reverse true all target/tracker-server.log org.h2.Driver jdbc:h2:./target/database sa true traccar CREATE TABLE user ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(1024) NOT NULL, email VARCHAR(256) NOT NULL UNIQUE, hashedPassword VARCHAR(1024) NOT NULL, salt VARCHAR(1024) DEFAULT '' 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(256) 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 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 INDEX position_deviceId_fixTime ON `position`(deviceId, fixTime); 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 traccar ( id INT PRIMARY KEY AUTO_INCREMENT); SELECT * FROM server; INSERT INTO server (registration, latitude, longitude, zoom) VALUES (:registration, :latitude, :longitude, :zoom); UPDATE server SET registration = :registration WHERE id = :id; SELECT * FROM user WHERE email = :email; SELECT * FROM user; INSERT INTO user (name, email, hashedPassword, salt, admin) VALUES (:name, :email, :hashedPassword, :salt, :admin); UPDATE user SET name = :name, email = :email, admin = :admin WHERE id = :id; UPDATE user SET hashedPassword = :hashedPassword, salt = :salt WHERE id = :id; DELETE FROM user WHERE id = :id; SELECT userId, deviceId FROM user_device; SELECT * FROM device; SELECT * FROM device d INNER JOIN user_device ud ON d.id = ud.deviceId WHERE ud.userId = :userId; INSERT INTO device (name, uniqueId) VALUES (:name, :uniqueId); UPDATE device SET name = :name, uniqueId = :uniqueId WHERE id = :id; DELETE FROM device WHERE id = :id; INSERT INTO user_device (userId, deviceId) VALUES (:userId, :deviceId); SELECT * FROM position WHERE deviceId = :deviceId AND fixTime BETWEEN :from AND :to; INSERT INTO position (deviceId, serverTime, deviceTime, fixTime, valid, latitude, longitude, altitude, speed, course, address, other) VALUES (:deviceId, NOW(), :time, :time, :valid, :latitude, :longitude, :altitude, :speed, :course, :address, :other); SELECT * FROM position WHERE id IN (SELECT positionId FROM device); UPDATE device SET positionId = :id WHERE id = :deviceId; 5000 5001 5002 5003 5004 5005 5006 false 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 false 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087