Hello guys
I'm training to be an application designer and developer. I have to present a project to the jury. I'm learning Kotlin on the side, but I'm having trouble with the data design model. I have many-to-many relationships, which makes things vague and complex. Can you help me?
My project is to create a Discord-style app, or at least a simple messaging app. I have to present this project to the jury for 40 minutes.
CREATE TABLE user_account(
account_id INT,
account_name VARCHAR(20) NOT NULL,
account_tag VARCHAR(4) NOT NULL,
account_email VARCHAR(100) NOT NULL,
password VARCHAR(60) NOT NULL,
avatar_path VARCHAR(500) NOT NULL,
PRIMARY KEY(account_id),
UNIQUE(account_tag),
UNIQUE(account_email)
);
CREATE TABLE channel(
channel_id INT,
PRIMARY KEY(channel_id)
);
CREATE TABLE role(
role_id INT,
label VARCHAR(50) NOT NULL,
PRIMARY KEY(role_id),
UNIQUE(label)
);
CREATE TABLE message(
message_id INT,
message_date DATETIME NOT NULL,
message_content VARCHAR(2000) NOT NULL,
channel_id INT NOT NULL,
account_id INT NOT NULL,
PRIMARY KEY(message_id),
FOREIGN KEY(channel_id) REFERENCES channel(channel_id),
FOREIGN KEY(account_id) REFERENCES user_account(account_id)
);
CREATE TABLE linkedTo(
account_id INT,
channel_id INT,
PRIMARY KEY(account_id, channel_id),
FOREIGN KEY(account_id) REFERENCES user_account(account_id),
FOREIGN KEY(channel_id) REFERENCES channel(channel_id)
);
CREATE TABLE assignedTo(
account_id INT,
role_id INT,
PRIMARY KEY(account_id, role_id),
FOREIGN KEY(account_id) REFERENCES user_account(account_id),
FOREIGN KEY(role_id) REFERENCES role(role_id)
);