-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
Jonathan Bae edited this page Sep 27, 2019
·
11 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
has_many :notebookshas_many :noteshas_many :tags
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| title | string | not null, indexed |
| author_id | integer | not null, indexed, foreign_key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
- index on author_id
belongs_to :userhas_many :notes
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| title | string | not null, indexed |
| content | text | not null |
| author_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 |
- index on author_id
- index on notebook_id
belongs_to :userbelongs_to :notebookhas_many :taggings
| column name | data type | details |
|---|---|---|
| id | integer | not null, primary key |
| name | string | not null, indexed |
| created_at | datetime | not null |
| updated_at | datetime | not null |
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 |
- index on tag_id, note_id, unique: true
belongs_to :tagbelongs_to :note