diff options
author | Demian <demianalonso@gmail.com> | 2015-06-09 16:29:27 -0300 |
---|---|---|
committer | Demian <demianalonso@gmail.com> | 2015-06-09 16:29:27 -0300 |
commit | c4f3d8958caf55f99e383553980d8c2eea968243 (patch) | |
tree | 79b949864639eda7016fe6686da2733e1e52f27c /debug.xml | |
parent | b70876b7a3b852d0f0b9aade30d6a9405c054ac5 (diff) | |
download | trackermap-server-c4f3d8958caf55f99e383553980d8c2eea968243.tar.gz trackermap-server-c4f3d8958caf55f99e383553980d8c2eea968243.tar.bz2 trackermap-server-c4f3d8958caf55f99e383553980d8c2eea968243.zip |
Added compatibility for MySQL on all queries. Moved the sha256 logic to java to make it compatible across all databases
Diffstat (limited to 'debug.xml')
-rw-r--r-- | debug.xml | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -37,12 +37,12 @@ <entry key='database.user'>sa</entry> <entry key='database.password'></entry> <entry key='database.mock'>true</entry> - + <entry key='database.createSchema'> CREATE TABLE user ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(1024) NOT NULL, - email VARCHAR(1024) NOT NULL UNIQUE, + email VARCHAR(256) NOT NULL UNIQUE, password VARCHAR(1024) NOT NULL, salt VARCHAR(1024) DEFAULT '' NOT NULL, readonly BOOLEAN DEFAULT false NOT NULL, @@ -58,7 +58,7 @@ CREATE TABLE device ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(1024) NOT NULL, - uniqueId VARCHAR(1024) NOT NULL UNIQUE, + uniqueId VARCHAR(256) NOT NULL UNIQUE, status VARCHAR(1024), lastUpdate TIMESTAMP, positionId INT, @@ -67,8 +67,8 @@ CREATE TABLE user_device ( userId INT NOT NULL, deviceId INT NOT NULL, - read BOOLEAN DEFAULT true NOT NULL, - write BOOLEAN DEFAULT true 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); @@ -101,7 +101,7 @@ FOREIGN KEY (deviceId) REFERENCES device(id)); ALTER TABLE device ADD - FOREIGN KEY (positionId) REFERENCES position(id); + FOREIGN KEY (positionId) REFERENCES `position`(id); ALTER TABLE device ADD FOREIGN KEY (dataId) REFERENCES data(id); @@ -133,7 +133,7 @@ <entry key='database.loginUser'> SELECT * FROM user - WHERE email = :email AND password = CAST(HASH('SHA256', STRINGTOUTF8(:password), 1000) AS VARCHAR); + WHERE email = :email AND password = :password; </entry> <entry key='database.selectUsersAll'> @@ -142,18 +142,21 @@ <entry key='database.insertUser'> INSERT INTO user (name, email, password, admin) - VALUES (:name, :email, CAST(HASH('SHA256', STRINGTOUTF8(:password), 1000) AS VARCHAR), :admin); + VALUES (:name, :email, :password, :admin); </entry> <entry key='database.updateUser'> UPDATE user SET name = :name, email = :email, - admin = :admin, - password = CASEWHEN((SELECT password FROM user WHERE id = :id) = :password, :password, CAST(HASH('SHA256', STRINGTOUTF8(:password), 1000) AS VARCHAR)) + admin = :admin WHERE id = :id; </entry> + <entry key='database.updateUserPassword'> + UPDATE user SET password = :password WHERE id = :id; + </entry> + <entry key='database.deleteUser'> DELETE FROM user WHERE id = :id; </entry> |