I am trying to create multiple account types management system.
At first time, I have to types normal
type, and professional
type (each type has own table, so I have two tables at this time), and new tables are coming.
Each account type has some profiles. Each profile has own table, example: table profile_from_service_A
, table profile_from_service_B
, ... (new profile types are coming).
When new record is inserted to normal
(or professional
) table, I call to service A, service B, .. to create profiles, and insert profile result to corresponding table. There is not any relation between these service about business domain.
Most used query is used for reporting , example result: (account_id, account_type, profile_A_id, profile_A_propery_1, profile_A_propery_2, profile_B_id, profile_B_name, profile_E_id,...)
I intend create two mapping tables. For profile_from_service_A
, mapping table is service_A_account_mapping
with columns: (id_service_A, account_type, accounnt_id)
, account_type
is normal
or professional
at this time.
This structure is also used for service_B_account_mapping
, but I use id_service_B
instead of id_service_A
If there is new profile, I have to create new mapping table.
Another solution: add profile_A_id
, profile_B_id
to normal
, professional
tables. Don't use mapping table anymore.
So which solution is better?
Thank you!