Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
https://splunk.com/en_us/blog/....
You should learn a little bit about common data structure pitfalls. -
b2plane63951y@Lensflare @lungdart thanks. I ask this because, if i group all of the types of users in 1 entity, i will always have some fields null.
For example lets say
Seller:
- first_name
- last_name
Is optional. It can be null or it can be set and this is available for every seller.
Buyer:
- Does never have to set their first and last name, these fields do not exist for the buyer, so these fields will always be null when a user registers as a buyer.
This is just a simplified example. Now imagine the rest of the User-Related fields that will only get applied to sellers, only get applied to buyers, only get applied to admins, etc
TLDR:
By keeping it all as 1 user entity, some of those fields will always be null in 100% cases depending on the Role. Is this normal? -
hjk10157311y@b2plane one model is royally fucked if a single user is a buyer and a seller or needs correction because wrong pick.
-
you _don't_ have four types of user.
you have _one_ type of user, and four _roles_ which users can belong to.
there. i've solved your life now. -
@jestdotty the teal deer is to look at the bullet points under each normalization form in the same link.
Chat gpt is excellent at boiling down a topic like this as well. -
@jestdotty i can only lead you to the watering hole. I can't make you drink.
If you want more details of the points you didn't mention that were listed, feel free to read more.
If i have 4 types of user in a system, is it better to separate them each individually into their own models:
- UserA
- UserB
- UserC
- UserD
or should i group them all into 1 model:
- User
And then add an attribute Role in order to distinguish each one?
What is the proper way?
Entities:
- admin
- staff
- seller
- buyer
How would you structure these as ER diagram?
rant