Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database design 1 to 1 relationship

I design my database incorrectly, should I fix this while its in development?

"user" table is suppose to have a 1.1 relationship with "userprofile" table

however the actual design the "user" table has a 1.* relationship with "userprofile" table.

Everything works! but should it be fixed anyways?

like image 922
001 Avatar asked Jan 24 '26 03:01

001


2 Answers

Do one thing

User Table 
   Userid(p)
   UserName
   othercol..

UserProfile 
   id(p)
   UserId(f) - and unique
   othercol..

hope this way you can easily fix the isse

like image 117
Pranay Rana Avatar answered Jan 25 '26 23:01

Pranay Rana


Make the user_id in the user_profile table unique and its fixed.

like image 31
Justin Avatar answered Jan 26 '26 01:01

Justin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!