-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
aaxzheng edited this page Nov 14, 2018
·
5 revisions
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| username | string | not null, indexed |
| 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 |
- index on username, unique:true
- index on session_token , unique:true
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| body | text | 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 |
- user_id references the user
- notebook_id references the notebook that the note belongs to.
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| title | string | not null |
| user_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- user_id references the user
- title is the name of the notebook
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| tag | string | not null |
| user_id | integer | not null, indexed, foreign key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- user_id references the user
- tag is the name of the tag
| 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 |
- This is a join table that connects tags and notes in a many to many relationship
- note_id belongs to a note and tag_id belongs to a tag