I'm having a go at creating my own social networking website and I am having a few problems getting the idea of how friends work, at the minute I just want the simple concept of someone views your profile, decides to add you as a friend and then the friend request need to be accepted. In my database I have...
id, Auto-increment, Primary Key
Profile_id1 //user who added the other user
profile_id2 //user to confirm the friendship
confirm // 0 for not yet accepted and 1 for accepted
I know you need to create a foreign key between both profile_id to the user's usernames on the profile, but on my database I don't have an option for a foreign key, so how else would I be able to make this foreign key? I have primary, unique and index. Is a unique key the same as a foreign key?
I need some help bad and I would appreciate any help. Also I have checked Facebook's schema which has helped me a bit.