Instagram

Tables (8)

comments

  • comment_id — SERIAL — Primary key — NOT NULL
  • post_id — SERIAL — Foreign key → posts.post_id — NOT NULL
  • user_id — SERIAL — Foreign key → users.user_id — NOT NULL
  • content — VARCHAR(300) — NOT NULL
  • attachment — VARCHAR(255)

followers

  • follower_id — SERIAL — Primary key — NOT NULL
  • user_id — SERIAL — Foreign key → users.user_id — NOT NULL

followings

  • following_id — SERIAL — Primary key — NOT NULL
  • user_id — SERIAL — Foreign key → users.user_id — NOT NULL

hashtags

  • hashtag_id — SERIAL — Primary key — NOT NULL
  • name — VARCHAR(50) — NOT NULL — UNIQUE

likes

  • post_id — SERIAL — Foreign key → posts.post_id — NOT NULL
  • user_id — SERIAL — Foreign key → users.user_id — NOT NULL

post_hashtag (Untitled)

  • post_id — SERIAL — Foreign key → posts.post_id — NOT NULL
  • user_id (user_id2) — SERIAL — Foreign key → posts.user_id — NOT NULL
  • hashtag_id — SERIAL — Foreign key → hashtags.hashtag_id — NOT NULL

posts

  • post_id — SERIAL — Primary key — NOT NULL
  • user_id (user_id2) — SERIAL — Foreign key → users.user_id — NOT NULL
  • attachment — VARCHAR(255)
  • created_at — DATE — NOT NULL
  • content — VARCHAR(1000) — NOT NULL

users

  • user_id — SERIAL — Primary key — NOT NULL
  • username — VARCHAR(200) — NOT NULL — NOT NULL
  • password — VARCHAR(200) — NOT NULL — NOT NULL
  • created_at — VARCHAR(200)
  • phone — VARCHAR(20) — UNIQUE
  • email — VARCHAR(200) — NOT NULL — UNIQUE
  • profile — VARCHAR(255)