From 843a370660646499c3007256be953506567f23fb Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 17 Oct 2015 12:35:16 +1300 Subject: Add linking and unlinking of devices --- debug.xml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'debug.xml') diff --git a/debug.xml b/debug.xml index b5ff02981..5c1600bf1 100644 --- a/debug.xml +++ b/debug.xml @@ -101,7 +101,7 @@ 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 ( @@ -184,7 +184,7 @@ UPDATE "user" SET hashedPassword = :hashedPassword, salt = :salt WHERE id = :id; - + DELETE FROM "user" WHERE id = :id; @@ -192,33 +192,37 @@ 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); + + DELETE FROM user_device WHERE userId = :userId AND deviceId = :deviceId; + + - SELECT * FROM position WHERE deviceId = :deviceId AND fixTime BETWEEN :from AND :to ORDER BY fixTime; + SELECT * FROM position WHERE deviceId = :deviceId AND fixTime BETWEEN :from AND :to ORDER BY fixTime; -- cgit v1.2.3