I'm building a site using a CMS that already holds user information such as userId, Username, Firstname, Lastname.
I want to build a system that holds additional user information such as the user's Title, Date of birth etc...
Should I:
- Create a new table to hold the additional fields? This would prevent needing duplicate data, but it means data is split between the CMS tables, and my custom tables.
- Create a seperate table to hold all the user info I need and keep it in sync with the CMS user table? The advantage I see is that the two systems would be separate, but it requires keeping the data in Sync between my system and the CMS.
What are the advantages / disadvantages of each approach?
-
I edited your question to remove the request for articles to avoid down-votes and close-votes for requesting resources. That is off topic. I also removed the request for "best practices" because questions like that almost always get closed as needing focus. Instead, I changed the question to ask for advantages and disadvantages of both approaches. That might be a more answerable question. Feel free to revert my edit if you do not agree with it.Greg Burghardt– Greg Burghardt2022年03月23日 13:59:46 +00:00Commented Mar 23, 2022 at 13:59
1 Answer 1
Assumed you are talking about a relational database (with the usual means for referential integrity), use approach #1 (new table only with additional fields), and create a view which joins the two tables and returns the fields you need from both together.
No need to reinvent the wheel by implementing your own synching mechanism.