-
Notifications
You must be signed in to change notification settings - Fork 2
Database Schema
Tamir Karssli edited this page Feb 28, 2019
·
10 revisions
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
username |
string | not null, indexed, unique |
email |
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
email, unique: true - index on
session_token, unique: true
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
caption |
text | |
user_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
user_idreferencesusersid - index on
user_id
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, foreign key |
post_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
user_idreferencesusersid -
post_idreferencespostsid - index on
[post_id, user_id], unique: true - index on
user_id, 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 |
post_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
user_idreferencesusersid -
post_idreferencespostsid
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, foreign key |
follower_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
user_idreferencesusersid -
follower_idreferencesusersid - index on
[follower_id, user_id], unique: true - index on
user_id, unique: true