Skip to content

Commit 2cd9228

Browse files
feat: expanded databases
1 parent 6040a4a commit 2cd9228

File tree

3 files changed

+70
-30
lines changed

3 files changed

+70
-30
lines changed

database/chatdb/init_chatdb.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
-- Create user-data table
1+
-- chats table
22
-- chat_id: UUID of the chat
33
-- group_id: UUID of the group in the chat
44
CREATE TABLE IF NOT EXISTS `chats` (
5-
chat_id INT PRIMARY KEY,
6-
group_id INT
5+
chat_id VARBINARY(16) PRIMARY KEY,
6+
group_id VARBINARY(16),
77
);
88

99
-- Create user-credentials table
@@ -13,9 +13,9 @@ CREATE TABLE IF NOT EXISTS `chats` (
1313
-- timestamp: time the message was sent
1414
-- content: content of the message
1515
CREATE TABLE IF NOT EXISTS `messages` (
16-
message_id INT PRIMARY KEY,
17-
chat_id INT,
18-
user_id INT,
16+
message_id VARBINARY(16) PRIMARY KEY,
17+
chat_id VARBINARY(16),
18+
user_id VARBINARY(16),
1919
timestamp INT,
2020
content VARCHAR(255) NOT NULL
2121
);

database/matchdb/init_matchdb.sql

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,42 @@
1-
-- Create user-data table
2-
-- user_id UUID associated with a user
3-
-- group_id UUID of the group a user has been matched withe
4-
CREATE TABLE IF NOT EXISTS `matching` (
5-
user_id INT PRIMARY KEY,
6-
group_id INT
1+
-- matches table
2+
-- contains information about what group a user has been matched with
3+
-- user_id UUID associated with a user
4+
-- group_id UUID of the group a user has been matched with
5+
-- rsvp Has the user RSVP'd the meeting
6+
CREATE TABLE IF NOT EXISTS `matches` (
7+
user_id VARBINARY(16) PRIMARY KEY,
8+
group_id VARBINARY(16) NOT NULL,
9+
rsvp BIT NOT NULL
710
);
811

9-
-- Create groups table
10-
-- group_id: UUID of each matched group
11-
-- meetup_time: Date and Time a group is set to meet
12+
-- groups table
13+
-- contains information about groups
14+
-- group_id: UUID of each matched group
15+
-- meet_time: time a group is set to meet at
16+
-- meet_date: date a group is set to meet at
17+
-- mensa: mensa a group is set to meet at
1218
CREATE TABLE IF NOT EXISTS `groups` (
13-
group_id INT PRIMARY KEY,
14-
meetup_time INT
19+
group_id VARBINARY(16) PRIMARY KEY,
20+
meet_date INT NOT NULL,
21+
meet_time INT NOT NULL,
22+
meet_place VARCHAR(255) NOT NULL,
23+
);
24+
25+
-- match requests table
26+
-- contains information about individual requests for matches made by users
27+
-- user_id UUID associated with a user
28+
-- group_id UUID of the group a user was matched with. Null if unmatched
29+
-- time_slot time slots a user is available to be matched, encoded as an integer
30+
-- date_slot date a user is available to be matched
31+
-- degree_pref whether a user prefers others with the same degree
32+
-- age_pref whether a user prefers others of similar age
33+
-- gender_pref whether a user prefers others of the same gender
34+
CREATE TABLE IF NOT EXISTS `match_requests` (
35+
user_id VARBINARY(16) PRIMARY KEY,
36+
group_id VARBINARY(16),
37+
time_slot INT NOT NULL,
38+
date_slot INT NOT NULL,
39+
degree_pref BIT,
40+
age_pref BIT,
41+
gender_pref BIT
1542
);

database/userdb/init_userdb.sql

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
1-
-- Create user-data table
2-
-- user_id: UUID of the given user
3-
-- name: user's name
4-
-- gender: user's gender
5-
-- TODO: Add more data
1+
-- user-data table
2+
-- contains basic information about a user provided on first login
3+
-- user_id: UUID of the given user
4+
-- user_email: User's E-Mail address
5+
-- name: user's name
6+
-- gender: user's gender
7+
-- degree: user's TUM degree
8+
-- age: user's age
69
CREATE TABLE IF NOT EXISTS `user_data` (
7-
user_id INT PRIMARY KEY,
10+
user_id VARBINARY(16) PRIMARY KEY,
11+
email VARCHAR(255) UNIQUE NOT NULL,
812
name VARCHAR(255) NOT NULL,
9-
gender VARCHAR(255) NOT NULL
13+
gender VARCHAR(255) NOT NULL,
14+
degree VARCHAR(255) NOT NULL,
15+
age INT NOT NULL
16+
);
17+
18+
-- user-interests table
19+
-- contains pairs of users and interests based on information provided on login
20+
-- user_id: UUID of the given user
21+
-- interest: String representing a given interest
22+
CREATE TABLE IF NOT EXISTS `user_interests` (
23+
user_id VARBINARY(16) PRIMARY KEY,
24+
interest VARCHAR(255) UNIQUE NOT NULL
1025
);
1126

12-
-- Create user-credentials table
13-
-- user_id: UUID of the given user
14-
-- email: user's email used on login
15-
-- password_hash: user's hashed password
27+
-- user_credentials table
28+
-- user_id: UUID of the given user
29+
-- password_hash: user's hashed password
1630
CREATE TABLE IF NOT EXISTS `user_credentials` (
17-
user_id INT PRIMARY KEY,
18-
email VARCHAR(255) UNIQUE NOT NULL,
31+
user_id VARBINARY(16) PRIMARY KEY,
1932
password_hash VARCHAR(255) NOT NULL
2033
);

0 commit comments

Comments
 (0)