-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
Micah Jaffe edited this page Dec 6, 2018
·
11 revisions
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
username | string | not null, indexed, unique |
string | not null, indexed, unique | |
password_digest | string | not null |
session_token | string | not null, indexed, unique |
created_at | datetime | not null |
updated_at | datetime | not null |
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
name | string | not null, indexed, unique |
created_at | datetime | not null |
updated_at | datetime | not null |
user_id | integer | not null, foreign key |
-
user_id
referencesusers
table
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
title | string | indexed, default: 'Untitled |
body | text | |
created_at | datetime | not null |
updated_at | datetime | not null |
notebook_id | integer | not null, foreign key |
-
notebook_id
referencesnotebooks
table. All notes must belong to a notebook.user_id
can be recovered vianotebook
.
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
note_id | integer | not null, foreign key |
tag_id | integer | not null, foreign key |
created_at | datetime | not null |
updated_at | datetime | not null |
-
note_tags
is a joins table for the many-to-many relationship betweennotes
andtags
. A note can have zero or more tags. A tag can have zero or more notes (although typically will have at least one).
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
name | string | not null, indexed, unique |
created_at | datetime | not null |
updated_at | datetime | not null |