Skip to content

Database Schema

emmilco edited this page Mar 10, 2018 · 22 revisions

User

column name data type details
id integer not null, primary key
full_name string not null
email string not null, index
session_token string not null
password_digest string not null
bio string not null
timestamps datetime
*Note: Users have avatars

Article

column name data type details
id integer not null, primary key
title string not null, default: "untitled"
author_id integer not null, foreign key, indexed
publish_date datetime indexed
published boolean
timestamps datetime
*Note: Articles have featured images.

Chunk

column name data type details
id integer not null, primary key
chunkable_id integer not null, foreign key, indexed
content text
ord integer not null, indexed
content_type string in: [paragraph, h1, h2, h3, pull_quote, block_quote, divider, image], not null, default: "paragraph"
timestamps datetime

*in the first iteration, chunkable_id references an article. Eventually it will be revised to form the basis of a polymorphic association.

Comment

column name data type details
id integer not null, primary key
article_id integer not null, foreign key, indexed
author_id integer not null, foreign key, indexed
content text not null
timestamps datetime

Follow

column name data type details
id integer not null, primary key
follower_id integer not null, foreign key, indexed
followee_id integer not null, foreign key, indexed
timestamps datetime

Howl

column name data type details
id integer not null, primary key
howlable_id integer not null, foreign key, indexed
howlable_type string not null, indexed
howler_id integer not null, foreign key, indexed
timestamps datetime

Tag

column name data type details
id integer not null, primary key
tag_name string not null
timestamps datetime

Tagging

column name data type details
id integer not null, primary key
article_id integer not null, foreign key, indexed
tag_id integer not null, foreign key, indexed
timestamps datetime
Clone this wiki locally