Anyone? Any Ideas? Would be a great help!
[DB] Is it a good database design to implement?
This is not a Laravel relationquestion, This is a database related question. Because there is quite very advanced developers here, I am posting this question here.
I have a database design, but I'm not quite sure if this design is good for implementation. The design is as follows: (showing only related columns, there are several other columns in few table)
Approach A:
Table 1: Roles
id
role
Table 2: A_Users
id
email
role_id // reference ID on roles table
...
Table 3: B_Users
id
email
role_id //reference ID on roles table
...
Table 4: passwords
user_id // references ID on A_Users and B_Users Table. (not a foreign key, just and index)
password
remember_token
View 1 : users
id // references user_id from passwords tTble
email // references email from A_Users and B_Usres Tables
password // references password from Passwords Table
I can not merge A_users and B_users as they have different columns.
I have another approach which is:
Approach B:
Table 1: roles
id
role
Table 2: users
id
email
password
role_id //references id on roles table
...
Table 3: A_Users
id // references id on users table
...
Table 4: B_Users
id // references id on users table
view 1: A_Users_profile
id // references ID on A_users table
email // references email on users table
... //rest all from A_Users table
view 2: B_Users_profile
id // references ID on B_users table
email // references email on users table
... //rest all from B_Users table
The problem is, when B_Users are admins and A_Users are normal users.
So when A_Users register, they do not get profile instantly. B_users first verify the details and when they Approve, The password will be auto generated and emailed to A_users.
Now when A_users register, I have to store their email address in master table instead of Users (LogIn) table.
But then adding their email to Users table after approving will cause data repetition in 2 tables. So I came up above 2 approaches.
So, My question is Which approach would be a better one? As i'm not able to decide. Both seems to be equal to me.
And If none then, how can i implement this?
Thanks In Advance. :)
Please or to participate in this conversation.