Social network database schema

Followers, feeds and direct messages modelled for read volume: asymmetric follows, one posts table for replies and reposts, narrow like rows, per-participant read pointers and notifications.

Social Network ER diagram

Social network database schema n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 users idBIGINT usernameVARCHAR emailVARCHAR password_hashVARCHAR display_nameVARCHAR bioVARCHAR avatar_urlVARCHAR is_privateBOOLEAN is_verifiedBOOLEAN follower_countINTEGER following_countINTEGER created_atTIMESTAMP deactivated_atTIMESTAMP follows idBIGINT follower_idBIGINT followee_idBIGINT statusVARCHAR created_atTIMESTAMP blocks idBIGINT blocker_idBIGINT blocked_idBIGINT created_atTIMESTAMP posts idBIGINT author_idBIGINT parent_post_idBIGINT repost_of_idBIGINT bodyVARCHAR visibilityVARCHAR like_countINTEGER reply_countINTEGER repost_countINTEGER created_atTIMESTAMP deleted_atTIMESTAMP post_media idBIGINT post_idBIGINT storage_keyVARCHAR media_typeVARCHAR widthINTEGER heightINTEGER duration_secondsINTEGER alt_textVARCHAR positionINTEGER likes user_idBIGINT post_idBIGINT created_atTIMESTAMP comments idBIGINT post_idBIGINT author_idBIGINT parent_comment_idBIGINT bodyVARCHAR like_countINTEGER created_atTIMESTAMP deleted_atTIMESTAMP conversations idBIGINT is_groupBOOLEAN titleVARCHAR created_by_idBIGINT last_message_atTIMESTAMP created_atTIMESTAMP conversation_partic… conversation_idBIGINT user_idBIGINT joined_atTIMESTAMP last_read_message…BIGINT mutedBOOLEAN left_atTIMESTAMP messages idBIGINT conversation_idBIGINT sender_idBIGINT bodyVARCHAR media_keyVARCHAR created_atTIMESTAMP edited_atTIMESTAMP deleted_atTIMESTAMP notifications idBIGINT recipient_idBIGINT actor_idBIGINT notification_typeVARCHAR target_typeVARCHAR target_idBIGINT is_readBOOLEAN created_atTIMESTAMP

Related database schemas