-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
Colin Eckert edited this page Feb 13, 2021
·
8 revisions
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
email |
string | not null, indexed, unique |
full_name |
string | |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
email, unique: true
- index on
session_token, unique: true
- has many
notes
throughnotebooks
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null, unique, indexed |
author_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
author_id
referencesusers
- index on
[:name, :author_id], unique: true
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
title |
string | |
body |
text | not null |
notebook_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
notebook_id
referencesnotebooks
- index on
notebook_id
- has many
tags
throughnote_tags
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null, unique, indexed |
author_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
author_id
referencesusers
- index on
[:name, :author_id], unique: true
- has many
notes
throughnote_tags
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
note_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 |
-
note_id
referencesnotes
-
tag_id
referencestags
- index on
[:note_id, :tag_id], unique: true