To store task-related data, we will use the MySQL database. We will also store user and role information in database tables. The tables and their relationship details look as follows:
The table details are as follows:
- task: This table stores the details about tasks added into the system. It has a one-to-many relationship with the comments table.
- comments: When a user enters a task comment, it will be added to this table.
- users: This is a master table to store user details. It has a many-to-many relationship with the table role. It also has a one-to-many relationship with the task and comments tables.
- role: This is a master table for roles. Mainly, there are two roles—ROLE_USER and ROLE_ADMIN. It has a many-to-many relationship with the table users.
- user_role: This is a link table and will store the associated data of role and users.