Hacker News new | past | comments | ask | show | jobs | submit login

Behold the power of OO!!

  CREATE TABLE User (
         id serial PRIMARY KEY,
         full_name varchar(100) NOT NULL DEFAULT 'Anonynous Coward',
         ...
  );
  
  CREATE TABLE FacebookUser (
         fb_id int UNIQUE NOT NULL
  ) INHERITS (User);
  
  CREATE TABLE AppUser (
         uid int UNIQUE NOT NULL
  ) INHERITS (User);
  
  
  CREATE TABLE Friend (
         uid integer REFERENCES User (id),
         friends_with integer REFERENCES User (id)
  );


If you are able to pull the user data, you pull the list of friends and add to your table. The part where you use session information to check which user is accessing your web app is left as an exercise to the reader.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: