Skip to content

Database Schema

Cynthia Ma edited this page Feb 4, 2018 · 16 revisions

users

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

decks

column name data type details
id integer not null, primary key
title string not null, indexed
author_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • author_id references users

cards

column name data type details
id integer not null, primary key
question string not null
answer text not null
deck_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • deck_id references deck

tags

column name data type details
id integer not null, primary key
name string not null, indexed
created_at datetime not null
updated_at datetime not null

taggings

post_tags is a joins table between deck and tag. A deck can have multiple tags.

column name data type details
id integer not null, primary key
deck_id integer not null, indexed, foreign key
tag_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • deck_id references deck
  • tag_id references tag

Clone this wiki locally