Challenges with adding a 1-1 relational table (Users and UserSettings)

Ruseteefskt

New Member
My issue is related to this question: Entity Framework One-To-One Mapping IssuesI have a Users table that already has a bunch of records. \[code\]Users (Id, UserName, Password, FullName, Gender)\[/code\]I need to add a bunch of notification options for each user:\[code\]NotifyForNewCommentNotifyForNewPostNotifyWhenFriendSignsUp\[/code\]I may have to add more options later, but there will always be a 1-1 relationship, so my question is whether to store these in a separate table, say UserSettings, or just add them as columns to the Users table. In the linked question (above), the advice was to create a new table and make the UserId in the UserSettings table as the primary key (because otherwise, Entity Framework doesn't like it). If that's what I have to do, then I have a few questions regarding it:[*]All my tables have an Id column. The UserSettings will not have an Id column then, since the UserId will be the primary key?[*]I'd have to turn on Identity Insert for the UserSettings table, so that when I insert a new User record, I can also insert a UserSettings record with the UserId?[*]Given that I already have a bunch of records in the Users table, what do I have to do if I'm going to introduce the new UserSettings table now which will have a 1-1 relationship with the Users table? Do I just run a script to add records for each user in the Users table with some default values? Or do I make it into a 0-1 relationship?[*]Since it's a 1-1 relationship, should I not worry about a new table, and instead just add them as columns to the existing Users table?
 
Back
Top