From ed6a19b6afcd1ed737532732499fd3246041be59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Sun, 19 May 2024 22:42:56 +0200 Subject: [PATCH] #8: Setup Schema for User Login --- .idea/sqlDataSources.xml | 5 ++++- src/main/resources/de/hitec/nhplus/login/database/User.sql | 7 +++++++ .../de/hitec/nhplus/login/database/UserPermission.sql | 6 ++++++ .../de/hitec/nhplus/login/database/UserToNurse.sql | 7 +++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/de/hitec/nhplus/login/database/User.sql create mode 100644 src/main/resources/de/hitec/nhplus/login/database/UserPermission.sql create mode 100644 src/main/resources/de/hitec/nhplus/login/database/UserToNurse.sql diff --git a/.idea/sqlDataSources.xml b/.idea/sqlDataSources.xml index f73128a..ef907f0 100644 --- a/.idea/sqlDataSources.xml +++ b/.idea/sqlDataSources.xml @@ -27,9 +27,12 @@ - diff --git a/src/main/resources/de/hitec/nhplus/login/database/User.sql b/src/main/resources/de/hitec/nhplus/login/database/User.sql new file mode 100644 index 0000000..b92a04a --- /dev/null +++ b/src/main/resources/de/hitec/nhplus/login/database/User.sql @@ -0,0 +1,7 @@ +CREATE TABLE user +( + id INTEGER PRIMARY KEY AUTOINCREMENT, + username TEXT NOT NULL, + passwordSalt BLOB NOT NULL, + passwordHash BLOB NOT NULL +) \ No newline at end of file diff --git a/src/main/resources/de/hitec/nhplus/login/database/UserPermission.sql b/src/main/resources/de/hitec/nhplus/login/database/UserPermission.sql new file mode 100644 index 0000000..536dce0 --- /dev/null +++ b/src/main/resources/de/hitec/nhplus/login/database/UserPermission.sql @@ -0,0 +1,6 @@ +CREATE TABLE user__permissions +( + userId INTEGER NOT NULL, + permissions INTEGER, -- Binary Bitmask for Permissions + FOREIGN KEY (userId) REFERENCES user (id) ON DELETE CASCADE +) \ No newline at end of file diff --git a/src/main/resources/de/hitec/nhplus/login/database/UserToNurse.sql b/src/main/resources/de/hitec/nhplus/login/database/UserToNurse.sql new file mode 100644 index 0000000..4507f47 --- /dev/null +++ b/src/main/resources/de/hitec/nhplus/login/database/UserToNurse.sql @@ -0,0 +1,7 @@ +CREATE TABLE user__nurse +( + userId INTEGER NOT NULL, + nurseId INTEGER NOT NULL, + FOREIGN KEY (userId) REFERENCES user (id) ON DELETE CASCADE, + FOREIGN KEY (nurseId) REFERENCES nurse (id) ON DELETE CASCADE +) \ No newline at end of file