diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-18 16:32:46 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-18 16:32:46 +1300 |
commit | 5d974ea790397d0646f013e91c8d3b0829ffbd54 (patch) | |
tree | 7c4100ddd89d0bf0a4e20b9c165e6e66bed2bc09 /debug.xml | |
parent | 2c1aee51f375885b3ee575425814ca8cbe6129ff (diff) | |
download | trackermap-server-5d974ea790397d0646f013e91c8d3b0829ffbd54.tar.gz trackermap-server-5d974ea790397d0646f013e91c8d3b0829ffbd54.tar.bz2 trackermap-server-5d974ea790397d0646f013e91c8d3b0829ffbd54.zip |
Finish Liquibase migration implementation
Diffstat (limited to 'debug.xml')
-rw-r--r-- | debug.xml | 122 |
1 files changed, 18 insertions, 104 deletions
@@ -49,98 +49,12 @@ <entry key='database.password'></entry> <entry key='database.mock'>true</entry> <entry key='database.xml'>false</entry> - <entry key='database.changelog'>./database/db.changelog-master.xml</entry> - <entry key='database.checkTable'>traccar</entry> - - <entry key='database.selectSchemaVersion'> - SELECT * FROM traccar; - </entry> - - <entry key='database.createSchema'> - CREATE TABLE "user" ( - id INT PRIMARY KEY AUTO_INCREMENT, - name VARCHAR(128) NOT NULL, - email VARCHAR(128) NOT NULL UNIQUE, - hashedPassword VARCHAR(128) NOT NULL, - salt VARCHAR(128) DEFAULT '' NOT NULL, - readonly BIT DEFAULT 0 NOT NULL, - admin BIT DEFAULT 0 NOT NULL, - map VARCHAR(128), - language VARCHAR(128), - distanceUnit VARCHAR(128), - speedUnit VARCHAR(128), - latitude DOUBLE PRECISION DEFAULT 0 NOT NULL, - longitude DOUBLE PRECISION DEFAULT 0 NOT NULL, - zoom INT DEFAULT 0 NOT NULL); - - CREATE TABLE device ( - id INT PRIMARY KEY AUTO_INCREMENT, - name VARCHAR(128) NOT NULL, - uniqueId VARCHAR(128) NOT NULL UNIQUE, - status VARCHAR(128), - lastUpdate TIMESTAMP, - positionId INT); - - CREATE TABLE user_device ( - userId INT NOT NULL, - deviceId INT NOT NULL, - "read" BIT DEFAULT 1 NOT NULL, - "write" BIT DEFAULT 1 NOT NULL, - FOREIGN KEY (userId) REFERENCES "user" (id) ON DELETE CASCADE, - FOREIGN KEY (deviceId) REFERENCES device (id) ON DELETE CASCADE); - - CREATE INDEX user_device_userId ON user_device(userId); - - CREATE TABLE position ( - id INT PRIMARY KEY AUTO_INCREMENT, - protocol VARCHAR(128), - deviceId INT NOT NULL, - serverTime TIMESTAMP NOT NULL, - deviceTime TIMESTAMP NOT NULL, - fixTime TIMESTAMP NOT NULL, - valid BIT NOT NULL, - latitude DOUBLE PRECISION NOT NULL, - longitude DOUBLE PRECISION NOT NULL, - altitude FLOAT NOT NULL, - speed FLOAT NOT NULL, - course FLOAT NOT NULL, - address VARCHAR(512), - attributes VARCHAR(4096) NOT NULL, - FOREIGN KEY (deviceId) REFERENCES device (id) ON DELETE CASCADE); - - CREATE INDEX position_deviceId_fixTime ON position (deviceId, fixTime); - - CREATE TABLE server ( - id INT PRIMARY KEY AUTO_INCREMENT, - registration BIT NOT NULL, - readonly BIT NOT NULL, - map VARCHAR(128), - bingKey VARCHAR(128), - mapUrl VARCHAR(128), - language VARCHAR(128), - distanceUnit VARCHAR(128), - speedUnit VARCHAR(128), - latitude DOUBLE PRECISION DEFAULT 0 NOT NULL, - longitude DOUBLE PRECISION DEFAULT 0 NOT NULL, - zoom INT DEFAULT 0 NOT NULL); - - CREATE TABLE traccar ( - version INT DEFAULT 0 NOT NULL); - - INSERT INTO traccar (version) VALUES (302); - </entry> - <entry key='database.selectServers'> SELECT * FROM server; </entry> - <entry key='database.insertServer'> - INSERT INTO server (registration, readonly, latitude, longitude, zoom) - VALUES (:registration, :readonly, :latitude, :longitude, :zoom); - </entry> - <entry key='database.updateServer'> UPDATE server SET registration = :registration, @@ -158,26 +72,26 @@ </entry> <entry key='database.loginUser'> - SELECT * FROM "user" + SELECT * FROM users WHERE email = :email; </entry> <entry key='database.selectUser'> - SELECT * FROM "user" + SELECT * FROM users WHERE id = :id; </entry> <entry key='database.selectUsersAll'> - SELECT * FROM "user"; + SELECT * FROM users; </entry> <entry key='database.insertUser'> - INSERT INTO "user" (name, email, hashedPassword, salt, admin) + INSERT INTO users (name, email, hashedPassword, salt, admin) VALUES (:name, :email, :hashedPassword, :salt, :admin); </entry> <entry key='database.updateUser'> - UPDATE "user" SET + UPDATE users SET name = :name, email = :email, admin = :admin, @@ -192,11 +106,11 @@ </entry> <entry key='database.updateUserPassword'> - UPDATE "user" SET hashedPassword = :hashedPassword, salt = :salt WHERE id = :id; + UPDATE users SET hashedPassword = :hashedPassword, salt = :salt WHERE id = :id; </entry> <entry key='database.deleteUser'> - DELETE FROM "user" WHERE id = :id; + DELETE FROM users WHERE id = :id; </entry> <entry key='database.getPermissionsAll'> @@ -204,27 +118,27 @@ </entry> <entry key='database.selectDevicesAll'> - SELECT * FROM device; + SELECT * FROM devices; </entry> <entry key='database.selectDevices'> - SELECT * FROM device d INNER JOIN user_device ud ON d.id = ud.deviceId WHERE ud.userId = :userId; + SELECT * FROM devices d INNER JOIN user_device ud ON d.id = ud.deviceId WHERE ud.userId = :userId; </entry> <entry key='database.insertDevice'> - INSERT INTO device (name, uniqueId) VALUES (:name, :uniqueId); + INSERT INTO devices (name, uniqueId) VALUES (:name, :uniqueId); </entry> <entry key='database.updateDevice'> - UPDATE device SET name = :name, uniqueId = :uniqueId WHERE id = :id; + UPDATE devices SET name = :name, uniqueId = :uniqueId WHERE id = :id; </entry> <entry key='database.updateDeviceStatus'> - UPDATE device SET status = :status, lastUpdate = :lastUpdate WHERE id = :id; + UPDATE devices SET status = :status, lastUpdate = :lastUpdate WHERE id = :id; </entry> <entry key='database.deleteDevice'> - DELETE FROM device WHERE id = :id; + DELETE FROM devices WHERE id = :id; </entry> <entry key='database.linkDevice'> @@ -236,20 +150,20 @@ </entry> <entry key='database.selectPositions'> - SELECT * FROM position WHERE deviceId = :deviceId AND fixTime BETWEEN :from AND :to ORDER BY fixTime; + SELECT * FROM positions WHERE deviceId = :deviceId AND fixTime BETWEEN :from AND :to ORDER BY fixTime; </entry> <entry key='database.insertPosition'> - INSERT INTO position (deviceId, protocol, serverTime, deviceTime, fixTime, valid, latitude, longitude, altitude, speed, course, address, attributes) - VALUES (:deviceId, :protocol, CURRENT_TIMESTAMP(), :time, :time, :valid, :latitude, :longitude, :altitude, :speed, :course, :address, :attributes); + INSERT INTO positions (deviceId, protocol, serverTime, deviceTime, fixTime, valid, latitude, longitude, altitude, speed, course, address, attributes) + VALUES (:deviceId, :protocol, :now, :time, :time, :valid, :latitude, :longitude, :altitude, :speed, :course, :address, :attributes); </entry> <entry key='database.selectLatestPositions'> - SELECT * FROM position WHERE id IN (SELECT positionId FROM device); + SELECT * FROM positions WHERE id IN (SELECT positionId FROM devices); </entry> <entry key='database.updateLatestPosition'> - UPDATE device SET positionId = :id WHERE id = :deviceId; + UPDATE devices SET positionId = :id WHERE id = :deviceId; </entry> <!-- PROTOCOL CONFIG --> |