-
Notifications
You must be signed in to change notification settings - Fork 0
Database Schema
Yu-Jen Chang edited this page Apr 2, 2018
·
3 revisions
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| username | 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 |
- user has_many notes
- user has_many notebooks
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| title | string | not null, indexed, unique |
| body | string | not null |
| user_id | integer | not null, indexed, foreign key |
| notebook_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- note belongs_to user
- note belongs_to notebook
- note has_many taggings
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| title | string | not null, indexed, unique |
| user_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- notebook belongs_to user
- notebook has_many notes
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| name | string | not null |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- tags has_many taggings
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| tag_id | integer | not null, indexed, foreign key |
| note_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- taggings belongs_to tag
- taggings belongs_to note