Database schema - saipat/Eton GitHub Wiki
Users
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
username |
string | not null, unique |
email |
string | not null, unique |
password_digest |
string | not null |
session_token |
string | not null, unique |
created_time |
datetime | not null |
updated_time |
datetime | not null |
- index on
username
,email
,session_token
has_many
notebooks
has_many
tags
Notes
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
title |
string | not null |
notebook_id |
integer | not null, foreign key |
plain_txt_body |
text | not null |
rich_txt_body |
text | not null |
created_time |
datetime | not null |
updated_time |
datetime | not null |
- index on
title
,plain_txt_body
,rich_txt_body
belongs_to
notebook
Notebooks
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
user_id |
integer | not null, foreign key |
created_time |
datetime | not null |
updated_time |
datetime | not null |
- index on
user_id
belongs_to
users
has_many
notes
dependent
destroy
Tags
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, foreign key |
tag_name |
string | not null |
created_time |
datetime | not null |
updated_time |
datetime | not null |
- index on
tag_name
- index on [
user_id
,tag_name
], unique: true belongs_to
users
Tags_notes
column name | data type | details |
---|---|---|
id |
integer | primary key |
tag_id |
integer | foreign key, unique |
note_id |
integer | not null, foreign key, unique |
created_time |
datetime | not null |
updated_time |
datetime | not null |
- index on
[tag_ig, note_id]
unique: true
belongs_to
note
belongs_to
tag