In my application I have a user which has a profile and an address. The relationship between those tables are:
- users:
id
, type, registered, email... - profiles:
user_id
,address_id
, first_name, last_name, gender, status, etc.. - addresses:
id
, city, street, house_number, apartment
Those tables have some Enum
fields on them, but I think it might not be efficient at-all since I'm going to do some intensive user's lookup based on their address and profile so I thought maybe I should use reference tables instead? (I also gain the indexing with an integer which is better).
For example, In profiles
I have a status
enum field which gets the following values for now:
- single
- married
- widowed
- divorced
so I thought about maybe having a statuses
table and a foreign key on profiles
- status_id
.
Another dilemma about this is should I have a reference table for a gender as-well? Currently I only accept male
and female
values in my enum field for gender, but maybe in the future we will want to add a transgender or anything else. I will also do an intensive user lookup based on gender of-course. Should I also extract it into a reference table?