Skip to content

Database Schema

Walter Hills edited this page Mar 19, 2021 · 7 revisions

Schema Outline

Users

column name data type details
id serial not null, primary key
firstName varchar(25) not null
lastName varchar(25) not null
email varchar(255) not null, unique
hashedPassword binary not null
  • Users hasMany Notebooks association

Notebooks

column name data type details
id serial not null, primary key
name varchar(55) not null, unique
user_id integer not null, foreign key
  • Notebooks belongsTo Users association

Notes

column name data type details
id serial not null, primary key
text text not null
title text not null
notebook_id integer not null, foreign key
  • Notes hasMany NotesToTags association
  • Notes belongsTo Notebooks association

NotesToTags

column name data type details
id serial not null, primary key
note_id integer not null, foreign key
tag_id integer not null, foreign key
  • NotesToTags belongsTo Notes association
  • NotesToTags belongsTo Tags association

Tags

column name data type details
id serial not null, primary key
tag varchar(255) not null
  • Tags hasMany NotesToTags association

Migration order: Users -> Notebooks -> Notes -> Tags -> NotesToTags

Clone this wiki locally