Schema - nohani/Thought-Bubble GitHub Wiki

Users

column name data type details
id integer not null, primary key
username string not null, unique, indexed
email string not null, unique, indexed
password_digest string not null
session_token string not null, unique, indexed
created_at datetime not null
updated_at datetime
  • username indexed, unique: true
  • email indexed, unique: true
  • session_token indexed, unique: true

Posts

column name data type details
id integer not null, primary key
author_id integer not null, foreign_key
type string not null, inclusion
content text not null
created_at datetime not null
updated_at datetime
  • user_id references the Users table
  • type includes: text, photo, quote, link, chat, audio, video

Follows

column name data type details
id integer not null, primary key
follower_id integer not null, foreign key
followee_id integer not null, foreign key
created_at datetime not null
updated_at datetime
  • follower_id references the Users table
  • followee_id references the Users table

Likes

column name data type details
id integer not null, primary key
post_id integer not null, foreign key
liker_id integer not null, foreign key
created_at datetime not null
updated_at datetime
  • post_id references the Posts table
  • liker_id references the Users table
  • add index on [post_id, liker_id] columns