0

I am diving into the backend development world as a front end dev, and I did start with a personal side project. It will be like a jobboard/freelance platform which will have a freelancer (user) and a company (user). What I had in mind is to create one User table and two tables for the two different roles (freelance_user and company_user).

So the user table holds all the basic data like email, passwords, profile images and the role specific table will be there to give access to specific parts of the app.

User
| id  | email  |  password | name
|---  |---|--- |---|---|
|     |   |    |   |   |
|     |   |    |   |   |
 

freelance_user
| id  | user_id  |  skill
|---  |---|--- |---|---|
|     |   |    |   |   |
|     |   |    |   |   |

company_user
| id  | user_id  |  company_id
|---  |---|--- |---|---|
|     |   |    |   |   |
|     |   |    |   |   |

Is this a correct setup? Now I am only thinking about how I would reference the role to the user table so I can manage app access/restrictions.

DennisKr
  • 23
  • 5
  • 1
    There are several "correct" ways of doing this. Which one is best for a given app depends how you will use the tables. You might like my answer here: https://stackoverflow.com/a/695860/20860 – Bill Karwin May 30 '22 at 17:39

0 Answers0