I would like start a project for learn on best way how to create a good schema for my future applications. I'm starting having some questions about my project but for now I'm really interested to know how to make a good schema on this scenario:
I'm starting seeing that i have 2 main category, normal users and teams. This "trick" work similar to facebook where the users can create the own team and they can switch the proprety and get the control of them team.
Having 2 different profiles, user profile and team profile. I need to show posts,comments and photos.
So my question is:
I have to create 2 type of tables one for user and the other one for team? Or is better create a unique table and have just column with an integer for know if is user or admin?
example
table users -- user_posts
table admin -- admin_posts
or
table user --|__ posts // and have a column "type" on where if is 1 is user if is 2 is
table team --|
I would go for the second option, allowing you more flexible development later.
table users
user_id, password, team_ID, etc
table team
team_id, admin_id (FKEY from user_id), name, description, etc
According to the team/group thing, you should create three tables:
For 3 you could add kind of a enum with defined rules inside your project ... eg admin, editor ... you name it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.